Ho appena letto la newsletter "Java Specialist" di Heinz Kabutz, dove riporta che Henri Tremblay ha trovato un modo di usare le tuple negli streams di Java 8:
Arrays.asList("1", "22", "333").stream() .map(v -> new Object() { String value = v; int length = v.length(); }) .filter(tuple -> tuple.length % 2 == 0) .forEach(tuple -> System.out.println(tuple.value)); Notate come in map() viene creata una anonymous inner class di Object con 2 fields, "value" e "length", che può poi essere referenziata dopo in altri metodi di Stream. Funziona da Java 8 in avanti. Devo dire che sono impressionato! -- Simone Bordet --- Finally, no matter how good the architecture and design are, to deliver bug-free software with optimal performance and reliability, the implementation technique must be flawless. Victoria Livschitz