LocalDate, LocalTime and LocalDateTime in Java Explained
LocalDate, LocalTime and LocalDateTime are immutable java.time classes without a time zone. See how to create, format, compare and convert them with examples.
2,887 posts about Java: questions with answers, tutorials and articles, newest first.
LocalDate, LocalTime and LocalDateTime are immutable java.time classes without a time zone. See how to create, format, compare and convert them with examples.
Learn why java.time replaced Date and Calendar, which class to pick, and how to format, parse, calculate and convert dates safely in Java.
Use DateTimeFormatter with LocalDate, LocalDateTime or ZonedDateTime to format dates in Java, and avoid the legacy SimpleDateFormat.
Schedule delayed and repeating tasks with java.util.Timer, understand its single-thread and exception pitfalls, and move to ScheduledExecutorService.
Runnable returns nothing, Callable returns a result and may throw checked exceptions. See both used with ExecutorService, Future and virtual threads.
Use ScheduledExecutorService to run Java tasks after a delay or on a repeating schedule, with fixed-rate or fixed-delay timing, cancellation and safe shutdown.
ScheduledExecutorService schedules one-off and repeating tasks on a thread pool. Learn fixed rate vs fixed delay, cancellation, shutdown and exception pitfalls.
Backpressure lets a slow subscriber control a fast publisher. See how request(n) works and which Reactor operators to use when a source cannot slow down.
Mono emits zero or one item and Flux emits zero to many. Learn how they differ, the core operators and how to use them in Spring WebFlux.
Project Reactor models async data as Mono and Flux pipelines that run when subscribed. Learn operators, schedulers, WebFlux usage and testing with StepVerifier.
Reactive programming builds non-blocking pipelines with backpressure. See the Flow API, Reactor examples and when to prefer virtual threads.
ForkJoinPool splits large CPU-bound jobs into subtasks and balances them across threads by work stealing. Includes a full RecursiveTask example.
Use exceptionally for fallbacks, handle for both outcomes and whenComplete for side effects. Includes CompletionException unwrapping and timeouts.
CompletableFuture lets you run Java code asynchronously and compose the results. See chaining, combining, error handling, timeouts and executor choices.
Use Optional as a return type to make missing values explicit, then unwrap it with map, orElseGet and orElseThrow instead of null checks.
Optional is a Java container that holds a value or is empty, making missing results explicit. Learn creation, orElse, map, flatMap and what to avoid.
Collectors turns a Java stream into lists, maps, strings and summaries. See toList, toMap, joining, groupingBy, partitioningBy and teeing with runnable examples.
reduce() folds a stream into a single value, while collect() accumulates elements into a container. See when to choose each, with examples.
flatMap() merges the streams returned for each element into a single stream. See how it differs from map() and how to use it with lists, words and Optional.
Call stream() on any Java collection to start a pipeline, then filter, map and collect. Also covers arrays, maps, parallel streams and common pitfalls.