bonjour je suis novice sur les streams et je bute sur un exos que je dois rendre voici l'exercice
il faut que je réecrive cette methode avec des streams
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 public Collection<Book> proceduralFunction() { List<Book> weirdBooksAround = new ArrayList<>(); List<Library> libraries = fetchLibraries(); for (Library lib : libraries) { if (lib.getDistanceToHome() < TOO_FAR) { Collection<Book> books = lib.getBooks(); for (Book book : books) { if (book.getType() == Type.NEW_AGE_STUFF) { weirdBooksAround.add(book); } } } } return weirdBooksAround;
Partager