Why You Need to Upgrade to Java 8 Already, enlace https://www.toptal.com/java/why-you-need-to-upgrade-to-java-8-already
Los amigos de Toptal han publicado un interesante articulo sobre Java 8, se tratan temas interesantes:
Los amigos de Toptal han publicado un interesante articulo sobre Java 8, se tratan temas interesantes:
- Lambda expressions.
- Stream API for working with Collections.
- Asynchronous task chaining with
CompletableFuture
.
- Brand new Time API.
Ejemplo de implementaciĆ³n de funciones
(Integer i1, Integer i2) -> i1 % 2 - i2 %
DescripciĆ³n de mĆ©todos referenciados, Stream APi
books.stream()
.filter(book -> book.year > 2005) // filter out books published in or before 2005
.map(Book::getAuthor) // get the list of authors for the remaining books
.filter(Objects::nonNull) // remove null authors from the list
.map(Author::getName) // get the list of names for the remaining authors
.forEach(System.out::println); // print the value of each remaining element
books.stream()
.filter(book -> book.year > 2005) // filter out books published in or before 2005
.map(Book::getAuthor) // get the list of authors for the remaining books
.filter(Objects::nonNull) // remove null authors from the list
.map(Author::getName) // get the list of names for the remaining authors
.forEach(System.out::println); // print the value of each remaining element
Sin duda un excelente articulo de referencia que muestra las principales caracterĆsticas de Java8.
Comments