Java Get Multiple Items From Collection
collections, filter, java
Solution
Google Collections have Predicates for this purpose.
Problem
Do Java collections have a built-in method to return multiple items from that collection? For example, the list below has n elements, some of which are duplicated in the list. How could I get all elements where the value = "one"? I realize it would be very easy to write my own method to achieve such functionality, I just wanted to make sure I am not missing a built in method to do this. ``` List<String> ls=new ArrayList<String>(); ls.add("one"); ls.add("two"); ls.add("three"); ls.add("one"); ls.add("one"); //some type of built in function???? //ls.getItems("one"); //should return elements 0,3,4 ``` Thanks