R
Robin Wenger
As the subject said I wonder whether there is really no one-liner for creating an ArrayList + assign of the first element +
return the new list. I have expected the following to work in such a way but it does NOT work:
Object77 oneObject = new Object77();
ArrayList<Object77> lObj = new ArrayList<Object77>(oneObject);
The following returns a boolean and not the desired List:
boolean success = (new ArrayListObject77>()).add(oneObject);
Any other ideas?
Or do I really have to split this simple operation into separate statements?
Robin
return the new list. I have expected the following to work in such a way but it does NOT work:
Object77 oneObject = new Object77();
ArrayList<Object77> lObj = new ArrayList<Object77>(oneObject);
The following returns a boolean and not the desired List:
boolean success = (new ArrayListObject77>()).add(oneObject);
Any other ideas?
Or do I really have to split this simple operation into separate statements?
Robin