is static type language ◦ => FunctionalInterface • Many buildin interfaces in java.util.function Function<TypeA, TypeB> f = (Type a) -> ( (TypeB)f(a)); // TypeA to TypeB BiFunction<TypeA, TypeB, TypeC> g=(TypeA a, TypeB b) -> ((TypeC)f(a,b)
type which represents may or may not have a value ◦ Before optional, use null in usual • Check calling isPresent() ◦ True: exists a valuve ◦ False: Doesn’t exists ; •
.map(s->Optional.of(s)) // List<Optional<String>> .map(s->s.map(u->Integer.valueOf(s)).orElse(0)) // List<String> .collect(Collectors.toList()) Some(1) / None // if no optional, we must insert if-null in all time!