Open GoogleCodeExporter opened 9 years ago
Wouldn't a utility method similar to the code you posted above suffice?
public static <E> ArrayList<E> toArrayList(List<E> list) {
if (list instanceof ArrayList) {
return (ArrayList<E>) list;
} else {
return new ArrayList<E>(list);
}
}
Original comment by sebastia...@otto.de
on 3 Jul 2012 at 8:27
Yes. But that relies on an instanceof ArrayList, which might end up doing a
whole re-creation of the entire list. I was hoping that an asArrayList()
function would guarantee that the output would be an ArrayList and also
guarantee that it wouldn't rebuild the entire list if later on Morphia decided
to return LinkedLists or some other List from asList().
Original comment by eli...@espoc.com
on 3 Jul 2012 at 8:31
Original issue reported on code.google.com by
eli...@espoc.com
on 25 Jun 2012 at 3:28