The idea:
I have an object
public class Book(){
private String name;
private Integer nbOfPage;
public Book()
...
}
And I got a list of this Object
List<Book> books = new ArrayList<Book>();
Now I was wondering if in guava or another librairie, there was a quick way to get a list of all the different names from all the books I got, something I could do:
List<String> names = new ArrayList<String>();
for (Book aBook : books){
if (!names.contains(aBook.getName()){
names.add(aBook.getName());
}
}
I think this way is a bit "heavy", my book list can have from 200 to 1200 books.
Regards,