public List<String> nombresOrdenadosPorTamaño() { var lista = nombres(); Collections.sort(lista, new Comparator<>() { public int compare(String s1, String s2) { return Integer.compare(s1.length(), s2.length()); } }); return lista; }
https://introcs.cs.princeton.edu/java/33design/images/lambda.png
(a, b) -> a + b
s -> s.length()
obj -> Objects.nonNull(obj)
código -> !código.isEmpty()
() -> listaDePrecios(lote)
obj -> System.out.println(obj)
(p1, p2) -> Double.compare(p1.precio(), p2.precio())
(id, precio) -> System.out.println(id + " " + precio)
(String s) -> s.length()
String::length
(a, b) -> Math.max(a, b)
Math::max
Objects::nonNull
System.out::println
Integer::parseInt
ArrayList::new
this::resolve
By Carlos Obregón