ArrayList Collection Operations
Demonstrates common ArrayList operations including add, remove, iterate, sort, and filter with practical examples for managing a list of items.
Demonstrates common ArrayList operations including add, remove, iterate, sort, and filter with practical examples for managing a list of items.
Uses CompletableFuture to compose asynchronous operations with thenApply, thenCompose, thenCombine, and exception handling for non-blocking pipelines.
Defines custom annotations with different retention policies and demonstrates runtime annotation processing via reflection for metadata-driven behavior.
Defines a custom exception hierarchy with domain-specific exceptions, demonstrating proper exception chaining, message formatting, and multi-catch handling.
Uses the java.time API to work with dates, times, durations, periods, and formatting, demonstrating modern date-time manipulation and parsing.
Uses ScheduledExecutorService to run delayed and periodic tasks, demonstrating fixed-rate and fixed-delay scheduling with proper shutdown handling.
Demonstrates reading and writing files using Java NIO with Path, Files, and BufferedReader, including proper resource management and exception handling.
Implements a generic Box class with type bounds, demonstrating how generics provide compile-time type safety while working with constrained type parameters.
Demonstrates HashMap operations including put, get, merge, computeIfAbsent, and iteration with entrySet, keySet, and forEach methods.
Demonstrates connecting to a database using JDBC, executing parameterized queries with PreparedStatement, and processing ResultSet with proper resource cleanup.
Demonstrates lambda expressions with built-in functional interfaces like Predicate, Function, Consumer, and Supplier for concise and readable code.
Demonstrates LinkedList operations including addFirst, addLast, peek, poll, and bidirectional iteration with ListIterator for queue and deque patterns.
Demonstrates four types of method references (static, instance, arbitrary object, constructor) to create concise and readable functional expressions.
Demonstrates serializing and deserializing objects to JSON format, showing how to persist and transfer structured data between application components.
Demonstrates using Optional to handle potentially absent values safely, with map, flatMap, filter, orElse, and ifPresent operations to avoid NullPointerExcep...
Uses Java pattern matching with switch expressions and type patterns to handle different object types concisely without explicit casts or instanceof checks.
Demonstrates Java record classes as concise immutable data carriers with automatic constructors, accessors, equals, hashCode, and toString methods.
Uses Pattern and Matcher classes to validate email addresses, extract groups, replace text, and split strings with regular expressions.
Demonstrates sealed classes and interfaces to create restricted class hierarchies, enabling exhaustive pattern matching and domain modeling with known subtypes.
Demonstrates advanced Stream collectors including groupingBy, partitioningBy, counting, joining, and teeing for complex data aggregation and transformation.
Shows how to process collections using Java Streams with map, filter, reduce, and collect operations to transform and aggregate data efficiently.
Demonstrates efficient string manipulation using StringBuilder for concatenation, insertion, deletion, and reversal operations in performance-critical code.
Demonstrates Java text blocks for multi-line string literals with proper indentation handling, template formatting, and SQL/JSON/HTML generation.
Creates a fixed thread pool to execute multiple tasks concurrently, demonstrating proper resource management with try-with-resources and shutdown handling.
Demonstrates try-with-resources with custom AutoCloseable objects, ensuring proper resource cleanup even when exceptions occur during resource usage.