If I have a collection, such as Collection<String> strs, how can I get the first item out? I could just call an Iterator, take its first next(), then throw the Iterator away. Is there a less wasteful way to do it?
Advertisement
Answer
Iterables.get(yourC, indexYouWant)
Because really, if you’re using Collections, you should be using Google Collections.