I am having a java ArrayList of integer
ArrayList <Integer> ageList = new ArrayList <Integer>();
I am having some integer values in this arrayList. I want to create a new ArrayList which has all elements in the above arrayList which passes a condition, like value between 25 and 35. ie if my ageList contains values
{12,234,45,33,28,56,27}
my newList should contain
{33,28,27}
How can I achieve this?
Note: I came to java from objective C background, where I used NSPredicate to easly do such kind of things..Any similiar methods in java?