Examples

Page 14 of 14

htmlSnippet

Ruby Text Annotations

Uses ruby, rt, and rp elements to add pronunciation guides and annotations above East Asian characters, with fallback support.

htmlSnippet

Section and Aside Layout

Creates a content layout using section and aside elements with proper heading hierarchy for main content and complementary sidebar information.

htmlSnippet

Semantic HTML Elements

Demonstrates semantic HTML5 elements for structuring content meaningfully, improving accessibility and SEO with proper document outline.

htmlSnippet

Time Element for Dates

Uses the time element with datetime attribute to represent dates and times in a machine-readable format for scheduling and display.

javaSnippet

Custom Exception Hierarchy

Defines a custom exception hierarchy with domain-specific exceptions, demonstrating proper exception chaining, message formatting, and multi-catch handling.

javaSnippet

Date and Time API

Uses the java.time API to work with dates, times, durations, periods, and formatting, demonstrating modern date-time manipulation and parsing.

javaSnippet

Scheduled Executor Service Tasks

Uses ScheduledExecutorService to run delayed and periodic tasks, demonstrating fixed-rate and fixed-delay scheduling with proper shutdown handling.

javaSnippet

File I/O with NIO

Demonstrates reading and writing files using Java NIO with Path, Files, and BufferedReader, including proper resource management and exception handling.

javaSnippet

Generic Class with Type Bounds

Implements a generic Box class with type bounds, demonstrating how generics provide compile-time type safety while working with constrained type parameters.

javaSnippet

JDBC Database Query

Demonstrates connecting to a database using JDBC, executing parameterized queries with PreparedStatement, and processing ResultSet with proper resource cleanup.

javaSnippet

Optional for Null Safety

Demonstrates using Optional to handle potentially absent values safely, with map, flatMap, filter, orElse, and ifPresent operations to avoid NullPointerExcep...

javaSnippet

Pattern Matching for Switch

Uses Java pattern matching with switch expressions and type patterns to handle different object types concisely without explicit casts or instanceof checks.

javaSnippet

Stream Collectors for Grouping

Demonstrates advanced Stream collectors including groupingBy, partitioningBy, counting, joining, and teeing for complex data aggregation and transformation.

javaSnippet

String Builder Manipulation

Demonstrates efficient string manipulation using StringBuilder for concatenation, insertion, deletion, and reversal operations in performance-critical code.

javaSnippet

Thread Pool with ExecutorService

Creates a fixed thread pool to execute multiple tasks concurrently, demonstrating proper resource management with try-with-resources and shutdown handling.

sqlSnippet

Index Creation StQuerygies

Creates various index types including B-tree, partial, expression, and composite indexes to optimize different query patterns and access paths.

sqlSnippet

Views for Data Abstraction

Creates simple and materialized views to abstract complex queries, pre-compute expensive aggregations, and provide simplified data access patterns.