# Io / Github / Biezhi / Java11

## Overview

`io.github.biezhi.java11` appears to be an educational Java 11 examples area rather than a production feature package. The child modules each focus on one language or JDK capability, such as collections factories, file I/O, the HTTP client, interface private methods, process inspection, single-file execution, string APIs, time APIs, try-with-resources, and `var`.

Taken together, these sub-modules form a tour of Java 11 features. They do not appear to share runtime state or domain objects; instead, each package is intentionally self-contained so the examples can be run, read, and understood independently. The broader system role is therefore instructional: it demonstrates how modern Java 11 features fit into everyday coding patterns.

## Sub-module Guide

### Collections
The `collections` module shows immutable collection factories and the diamond operator with anonymous generic classes. It focuses on how Java 11 code can create compact, expressive collection values without mutable setup code.

### Files
The `files` module demonstrates the basic lifecycle of a text file: write, read back, compare, and delete. It complements the other I/O-oriented examples by showing the simplest direct file round trip.

### Http
The `http` module is the richest integration example. It demonstrates synchronous and asynchronous HTTP requests, JSON POSTs, file upload/download, proxy setup, authentication, HTTP/2, and parallel fan-out. This makes it the package that most clearly connects Java 11 APIs to external systems.

### Interfaces
The `interfaces` module explains how interface private methods and default methods work together. It shows that shared behavior can live inside the interface without being exposed as public API.

### Processor
The `processor` module is a very small process-introspection demo. It shows how to obtain the current JVM PID using `ProcessHandle`, which is useful as a baseline example for runtime inspection.

### Singlefile
The `singlefile` module demonstrates source-file launching. It shows how a `.java` file can be executed directly, emphasizing convenience for tiny demos and scripts.

### String
The `string` module explores Java 11 string helpers such as repeating, splitting into lines, stripping whitespace, and blank checks. It sits alongside the other language-feature examples as another small, focused API showcase.

### Time
The `time` module is a placeholder-style time API example package. Based on the available evidence, it follows the same one-feature, one-entry-point structure as the rest of the Java 11 examples.

### Trywithresources
The `trywithresources` module demonstrates the Java 9+ style of reusing an effectively final resource variable inside a try-with-resources block. It pairs naturally with `files` because both packages focus on safe resource handling.

### Var
The `var` module shows local variable type inference in several contexts: collections, streams, file I/O, enhanced for-loops, and resource declarations. It is one of the most cross-cutting examples because it touches many of the same JDK APIs as other modules while changing only the declaration style.

## Key Patterns and Architecture

The architecture is consistent across the entire area:

- **Single-topic packages** — each child module isolates one Java 11 feature so the examples stay small and easy to run.
- **Executable entry points** — most packages center on a single `Example.main(String[] args)` method, which makes each example directly runnable.
- **Console-first output** — the examples usually print to standard output rather than returning structured values, because the goal is to show behavior visibly.
- **Minimal shared state** — no cross-module dependencies or package-level orchestration were detected in the index.
- **Teaching-by-contrast** — several modules show how Java 11 reduces boilerplate compared with older patterns, especially in collections, resources, and local variable declarations.

This appears to be a deliberately modular learning design. Each package can be understood alone, but the set of packages together presents a broader narrative about how Java 11 improves expressiveness, I/O ergonomics, and API usability.

## Dependencies and Integration

The parent module itself has no resolved package dependencies in the index, and no cross-module relationships were detected. The children mostly depend on the Java standard library, with one notable exception in `http`, which also uses Gson for JSON serialization.

The strongest integration points are external rather than internal:

- **JDK collection and language APIs** in `collections`, `interfaces`, and `var`
- **JDK I/O APIs** in `files`, `trywithresources`, and `singlefile`
- **JDK networking APIs** in `http`
- **JDK runtime/process APIs** in `processor`
- **String and time APIs** in `string` and `time`

The module connects to the rest of the system mainly through documentation and runnable examples. There is no evidence that these packages provide services to one another or participate in a larger application flow.

## Mermaid Relationship Diagram

```mermaid
flowchart TD
Java11Module["io.github.biezhi.java11"] --> Collections["collections - immutable collections and generic examples"]
Java11Module --> Files["files - write, read, and delete text files"]
Java11Module --> Http["http - HttpClient request patterns"]
Java11Module --> Interfaces["interfaces - private interface methods and defaults"]
Java11Module --> Processor["processor - current process PID"]
Java11Module --> Singlefile["singlefile - source-file execution"]
Java11Module --> String["string - String API demonstrations"]
Java11Module --> Time["time - Java 11 time examples"]
Java11Module --> TryWithResources["trywithresources - reused resource declaration"]
Java11Module --> Var["var - local variable type inference"]
```

## Notes for Developers

- Treat these packages as examples, not abstractions. The code is intentionally direct so the feature being demonstrated stays obvious.
- Most of the modules are self-contained. If you change one example, there is usually no need to refactor the others.
- The I/O-related examples (`files`, `http`, `trywithresources`, `singlefile`) are the most environment-sensitive because they depend on local paths, filesystem state, or network availability.
- `http` is the only package that clearly relies on a third-party library. If you move or reuse it, remember that Gson is part of the example’s setup.
- `var`, `collections`, and `interfaces` are especially good reference points for understanding how Java 11 reduces boilerplate while preserving type safety.
- The `time` package has limited indexed detail, so any deeper work there should start by reading the source directly.
