Suppose I have an
ArrayList<Fruit>
I would like to get all elements from this list of any given subclass of Fruit, such as an
ArrayList<Apple>
C# seems to have a rather handy
OfType<T>()
method. Is there an equivalent way of doing this in Java?
Cheers
1 Answer