Tuesday, January 24, 2017

Why You Need to Upgrade to Java 8 Already

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:


  • 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



Sin duda un excelente articulo de referencia que muestra las principales características de Java8.




No comments: