Optional<T> là container có thể chứa giá trị hoặc trống, thay thế cho null check truyền thống. Methods: of(T) (non-null), ofNullable(T) (có thể null), empty(). Thao tác: isPresent(), isEmpty() (Java 11+), ifPresent(Consumer), map(), flatMap(), orElse(T), orElseThrow() (no-arg, Java 10+), stream() (Java 9+).
Ví dụ: Optional.ofNullable(obj).map(o -> o.getValue()).orElse("default") — chain an toàn không cần null check. Không dùng Optional cho field của entity hoặc method argument — chỉ dùng làm return type.