About Question enthuware.ocpjp.v17.2.3321 :
Posted: Sat Nov 19, 2022 10:07 am
books.sort(Comparator.comparing(Book::getGenre).thenComparing(Book::getTitle).reversed());
This reverses both the values (Genre and Title).
How do I reverse only the Title? Thanks
//result
[{non-fiction':Uri'}, {non-fiction':Becoming'}, {fiction':The Outsider'}, {fiction':Cujo'}]
This reverses both the values (Genre and Title).
How do I reverse only the Title? Thanks
//result
[{non-fiction':Uri'}, {non-fiction':Becoming'}, {fiction':The Outsider'}, {fiction':Cujo'}]