Suppose I have a class A with property b
Class A {
public int b;
}
There is a collection that containes instances of class A ArrayList col
How can I get an array of all values of property b from col? Is there a way more elegant than iteration through col and getting property of each object and then passign values of b to array?
LIst<Integer> propertyValues = new ArrayList<Integer>();
for (A a : col){
propertyValues.add(a.b);
}
Maybe a Spring utility method or something like that?