Extract particular elements from an existing Collection and put it into a
new Collection
I am using an API that returns a list like this:
List<Object[]> results = query.getResultList();
Each item in Object[] is an array like this
Array[MyObject, String , String]
I want to get the first element of each array ('MyObject') and put them
all in a new list
List<MyObject> myObjects.
I was wondering if there was a neat way of doing this using Collections
class or something similar instead of an algorithmic solution?
No comments:
Post a Comment