Runnable runnable = new Runnable() {
@Override
public void run() {
System.out.println("RUN");
}
};
Runnable runnable = () -> System.out.println("RUN");
Syntax
java.util.function
Omezení?
public class Customer {
...
public void printName() {
System.out.println(name);
}
}
customers.forEach(Customer::printName);
Problémy?
public Optional<Customer> getCustomer(String name) {}
Customer customer = getCustomer("jikra").orElse(DEFAULT_CUSTOMER);
Proč a kdy ho používat?
funkce
metody
metody
metody
source : {{a, b},{c, d},{e, f}}
map -> {a, b}, {c, d}, {e, f}
flatmap -> {a, b, c, d, e, f}
metody
DATE | LocalDate |
TIME | LocalTime |
TIMESTAMP | LocalDateTime |
TIME WITH TIMEZONE | OffsetTime |
TIMESTAMP WITH TIMEZONE | OffsetDateTime |