# Repository Overview

Welcome to this repository overview. This codebase appears to be a compact tour of Java 11 language and platform features, with each package demonstrating one specific capability in isolation. Rather than forming a single application, the modules are small teaching examples that show how modern JDK APIs behave in practice. If you're new here, think of the repository as a hands-on reference guide for Java 11 syntax and standard library usage.

## Overview

This repository appears to be organized as a set of focused examples, each centered on a single Java 11 feature area. The main goal is educational: the code shows how to use newer JDK APIs such as immutable collections, `HttpClient`, `String` enhancements, `ProcessHandle`, `var`, and try-with-resources improvements. Most modules have one runnable `Example` class and rely on console output to demonstrate behavior.

There is no evidence of a larger application framework or service architecture. Instead, the project seems to favor small, self-contained snippets that are easy to read, run, and modify. That makes it a useful starting point for engineers who want to learn or recall specific Java 11 features quickly.

## Technology Stack

This repository appears to use only the Java platform and standard library, with one external JSON library in the HTTP example.

- **Java 11** — the primary language and runtime target inferred from the package names and example content.
- **Java standard library** — used throughout for collections, files, HTTP, time, process handling, strings, and interfaces.
- **Gson** — used in the HTTP module for JSON serialization.
- **Mermaid** — used here to illustrate module relationships in documentation.

No well-known application frameworks were detected from the indexed imports.

## Architecture

The codebase is structured as a collection of independent feature demos under the `io.github.biezhi.java11` namespace. Each module is self-contained and generally depends only on the JDK, with the HTTP example also using Gson for a JSON payload.

```mermaid
flowchart TD
  Overview["Repository Overview"] --> Collections["collections module"]
  Overview --> Files["files module"]
  Overview --> Http["http module"]
  Overview --> Interfaces["interfaces module"]
  Overview --> Processor["processor module"]
  Overview --> SingleFile["singlefile module"]
  Overview --> StringModule["string module"]
  Overview --> Time["time module"]
  Overview --> TryWithResources["trywithresources module"]
  Overview --> Var["var module"]
  Collections --> JDK["Java standard library"]
  Files --> JDK
  Http --> JDK
  Interfaces --> JDK
  Processor --> JDK
  SingleFile --> JDK
  StringModule --> JDK
  Time --> JDK
  TryWithResources --> JDK
  Var --> JDK
  Http --> Gson["Gson"]
```

## Module Guide

### collections

The `collections` module appears to demonstrate Java collection factory methods and generic type ergonomics. The key references are [`Example`](src/main/java/io/github/biezhi/java11/collections/Example.java) and [`DiamondOperatorExample`](src/main/java/io/github/biezhi/java11/collections/DiamondOperatorExample.java). Together, they show immutable collection creation with `List.of`, `Map.of`, `Map.ofEntries`, `Set.of`, and the diamond operator with anonymous generic subclasses. This module is a good starting point if you want to understand how the newer collection creation APIs reduce boilerplate.

### files

The `files` module appears to focus on basic text file round-tripping with `Files.writeString`, `Files.readString`, and `Files.delete`. Its only class is [`Example`](src/main/java/io/github/biezhi/java11/files/Example.java), which writes a sample string to `hello.txt`, reads it back, verifies the contents, and removes the file. This is a compact introduction to Java NIO file convenience methods.

### http

The `http` module appears to be the largest example area in the repository and demonstrates many `HttpClient` capabilities. The main class is [`Example`](src/main/java/io/github/biezhi/java11/http/Example.java), supported by the small [`Foo`](src/main/java/io/github/biezhi/java11/http/Foo.java) data holder. The examples cover synchronous and asynchronous GETs, JSON POSTs, file downloads and uploads, proxy configuration, basic authentication, HTTP/2 configuration, and fan-out request execution. If you want the broadest view of the repository's runtime behavior, this module is likely the most feature-rich.

### interfaces

The `interfaces` module appears to show how Java interfaces can combine abstract methods, default methods, private helpers, and private static helpers. The single type, [`Example`](src/main/java/io/github/biezhi/java11/interfaces/Example.java), is itself an interface rather than a class. It is a good reference for modern interface design patterns and for understanding how default methods can share implementation details without exposing them publicly.

### processor

The `processor` module appears to be a tiny Process API example. Its [`Example`](src/main/java/io/github/biezhi/java11/processor/Example.java) class uses `ProcessHandle.current()` to print the current JVM process ID. This module is useful when you want to see the modern process API in the smallest possible form.

### singlefile

The `singlefile` module appears to demonstrate Java's single-source-file execution model. Its [`HelloWorld`](src/main/java/io/github/biezhi/java11/singlefile/HelloWorld.java) class prints a simple greeting and is presented as a direct-run example. This package is ideal for understanding how Java 11 supports running source files without a separate compile step in the usual workflow.

### string

The `string` module appears to showcase Java 11 `String` enhancements such as `repeat`, `lines`, `strip`, `stripLeading`, `stripTrailing`, and `isBlank`. The main class is [`Example`](src/main/java/io/github/biezhi/java11/string/Example.java), which contains several small demo methods and a header-printing helper. This module is especially useful as a quick reference for the behavior and output shape of these newer string APIs.

### time

The `time` module appears to demonstrate conversions between `java.time.Duration` and `java.util.concurrent.TimeUnit`. Its [`Example`](src/main/java/io/github/biezhi/java11/time/Example.java) class shows how duration values convert into whole days or minutes. This is a concise example for engineers who need to bridge modern time APIs with older timeout-oriented code.

### trywithresources

The `trywithresources` module appears to show the Java 9+ refinement to try-with-resources syntax, where an already-declared resource can be placed inside the `try (...)` header. The [`Example`](src/main/java/io/github/biezhi/java11/trywithresources/Example.java) class reads `./README.md` line by line using a `BufferedReader`. This package is best read as a language feature demonstration rather than an application pattern.

### var

The `var` module appears to focus on local variable type inference introduced in Java 11's language evolution. Its [`Example`](src/main/java/io/github/biezhi/java11/var/Example.java) class shows `var` with collections, streams, file paths, byte arrays, enhanced for-loops, and try-with-resources. It is a practical sample for understanding where `var` improves readability and where it may be less appropriate.

## Getting Started

If you're exploring the repository for the first time, a good reading order is:

1. Start with [`collections`](src/main/java/io/github/biezhi/java11/collections/Example.java) to get a feel for the style of the examples.
2. Read [`string`](src/main/java/io/github/biezhi/java11/string/Example.java) and [`var`](src/main/java/io/github/biezhi/java11/var/Example.java) next, since they demonstrate common language features in a very approachable way.
3. Move to [`files`](src/main/java/io/github/biezhi/java11/files/Example.java) and [`trywithresources`](src/main/java/io/github/biezhi/java11/trywithresources/Example.java) to see file access and resource cleanup patterns.
4. Review [`time`](src/main/java/io/github/biezhi/java11/time/Example.java) and [`processor`](src/main/java/io/github/biezhi/java11/processor/Example.java) for smaller platform API examples.
5. Read [`interfaces`](src/main/java/io/github/biezhi/java11/interfaces/Example.java) to understand modern interface capabilities.
6. Finish with [`http`](src/main/java/io/github/biezhi/java11/http/Example.java), since it covers the widest range of APIs and includes both synchronous and asynchronous code.
7. Use [`singlefile`](src/main/java/io/github/biezhi/java11/singlefile/HelloWorld.java) as a lightweight reference for direct source-file execution.

A few practical entry points stand out:

- `src/main/java/io/github/biezhi/java11/collections/Example.java`
- `src/main/java/io/github/biezhi/java11/string/Example.java`
- `src/main/java/io/github/biezhi/java11/http/Example.java`
- `src/main/java/io/github/biezhi/java11/var/Example.java`

If you are trying to understand the repository as a whole, the most helpful mental model is that each package is a standalone lesson. There does not appear to be a shared runtime or application lifecycle to learn first.

## Source References

- `.codewiki/io/github/biezhi/java11/collections.md`
- `.codewiki/io/github/biezhi/java11/files.md`
- `.codewiki/io/github/biezhi/java11/http.md`
- `.codewiki/io/github/biezhi/java11/interfaces.md`
- `.codewiki/io/github/biezhi/java11/processor.md`
- `.codewiki/io/github/biezhi/java11/singlefile.md`
- `.codewiki/io/github/biezhi/java11/string.md`
- `.codewiki/io/github/biezhi/java11/time.md`
- `.codewiki/io/github/biezhi/java11/trywithresources.md`
- `.codewiki/io/github/biezhi/java11/var.md
