Код: Выделить всё
public static void main(String[] args) {
List strings = Arrays.asList(“a”, “b”, “c”, “d”);
strings.stream()
.filter(s -> test(s, “temp”))
.map(s -> transform(s, “temp”))
.count();
}
public static boolean test(String s1, String s2) {
return s1.equals(s2);
}
public static String transform(String s1, String s2) {
return s1 + s2;
}
Для предикатов и функции имеет значение только тип возвращаемого значения, а не количество аргументов?
Подробнее здесь: https://stackoverflow.com/questions/785 ... d-function
Мобильная версия