This is a static site showcasing modern Java patterns vs legacy approaches. It is hosted on GitHub Pages at https://javaevolved.github.io.
Each pattern is defined as a JSON file under content/category/:
content/language/type-inference-with-var.json
content/collections/immutable-list-creation.json
content/streams/stream-tolist.json
...
Categories: language, collections, strings, streams, concurrency, io, errors, datetime, security, tooling, enterprise
The following are generated by html-generators/generate.java and must not be edited directly:
site/index.html— English homepage with preview cards (generated fromtemplates/index.html)site/language/*.html,site/collections/*.html, etc. — English detail pagessite/data/snippets.json— English aggregated search indexsite/{locale}/index.html— localized homepage (e.g.,site/es/index.html)site/{locale}/language/*.html, etc. — localized detail pagessite/{locale}/data/snippets.json— localized search index
Run jbang html-generators/generate.java to rebuild all generated files from the JSON sources and translations.
site/app.js— client-side search, filtering, code highlighting, locale detectionsite/styles.css— all stylingtemplates/slug-template.html— HTML template with{{placeholder}}tokens (content + UI strings) used by the generatortemplates/index.html— homepage template with{{tipCards}},{{snippetCount}}, and UI string placeholderstemplates/index-card.html— preview card template for the homepage gridhtml-generators/categories.properties— category ID → display name mappinghtml-generators/locales.properties— supported locales registry (locale=Display name)translations/strings/{locale}.yaml— UI strings per locale (labels, nav, footer, etc.)translations/content/{locale}/— translated pattern JSON files (partial, translatable fields only)
content/ # English content JSON files (source of truth, one per pattern)
proof/ # Proof scripts — one JBang .java file per pattern, proving it compiles
language/ # e.g. proof/language/TypeInferenceWithVar.java
collections/ # e.g. proof/collections/ImmutableListCreation.java
... # mirrors content/ category structure
translations/ # All i18n artifacts
strings/ # UI strings per locale (en.yaml, es.yaml, pt-BR.yaml)
content/ # Translated pattern files per locale (partial, translatable fields only)
es/ # Spanish translations (mirrors content/ folder structure)
pt-BR/ # Brazilian Portuguese translations
site/ # Deployable site (static assets + generated HTML)
es/ # Generated Spanish pages
pt-BR/ # Generated Portuguese pages
templates/ # HTML templates with {{…}} tokens for content + UI strings
html-generators/ # Build scripts, categories.properties, locales.properties
specs/ # Feature specifications (e.g., i18n-spec.md)
Each content/category/slug.json file has this structure:
{
"id": 1,
"slug": "type-inference-with-var",
"title": "Type inference with var",
"category": "language",
"difficulty": "beginner|intermediate|advanced",
"jdkVersion": "10",
"oldLabel": "Java 8",
"modernLabel": "Java 10+",
"oldApproach": "Explicit Types",
"modernApproach": "var keyword",
"oldCode": "// old way...",
"modernCode": "// modern way...",
"summary": "One-line description.",
"explanation": "How it works paragraph.",
"whyModernWins": [
{ "icon": "⚡", "title": "Short title", "desc": "One sentence." },
{ "icon": "👁", "title": "Short title", "desc": "One sentence." },
{ "icon": "🔒", "title": "Short title", "desc": "One sentence." }
],
"support": {
"state": "available",
"description": "Widely available since JDK 10 (March 2018)"
},
"prev": "category/slug-of-previous",
"next": "category/slug-of-next",
"related": [
"category/slug-1",
"category/slug-2",
"category/slug-3"
],
"docs": [
{ "title": "Javadoc or Guide Title", "href": "https://docs.oracle.com/..." }
]
}slugmust match the filename (without.json)categorymust match the parent folder namewhyModernWinsmust have exactly 3 entriesrelatedmust have exactly 3 entries (ascategory/slugpaths)docsmust have at least 1 entry linking to Javadoc or Oracle documentationprev/nextarecategory/slugpaths ornullfor first/last- Code in
oldCode/modernCodeuses\nfor newlines proofCodeis optional — a self-contained JShell snippet (with default imports available) that proves the modern approach compiles and runs correctly. Runjbang html-generators/proof.javato verify all proof snippets.
Categories and their display names are defined in html-generators/categories.properties:
| ID | Display |
|---|---|
language |
Language |
collections |
Collections |
strings |
Strings |
streams |
Streams |
concurrency |
Concurrency |
io |
I/O |
errors |
Errors |
datetime |
Date/Time |
security |
Security |
tooling |
Tooling |
enterprise |
Enterprise |
- Create
content/category/new-slug.jsonwith all required fields - Update
prev/nextin the adjacent patterns' JSON files - Run
jbang html-generators/generate.java - Add a proof script at
proof/category/SlugName.java(JBang,//JAVA 25+) — runjbang html-generators/proof.javato verify - (Optional) Create translated content files under
translations/content/{locale}/category/new-slug.jsonwith only translatable fields — or let the AI translation workflow handle it
The site supports multiple languages. See specs/i18n/i18n-spec.md for the full specification.
- UI strings: Hard-coded template text (labels, nav, footer) is extracted into
translations/strings/{locale}.yaml. Templates use{{dotted.key}}tokens (e.g.,{{nav.allPatterns}},{{sections.codeComparison}}). Missing keys fall back to the English value with a build-time warning. - Content translations: Translated pattern files under
translations/content/{locale}/contain only translatable fields (title,summary,explanation,oldApproach,modernApproach,whyModernWins,support.description). All other fields (oldCode,modernCode,slug,id,prev,next,related,docs, etc.) are always taken from the English source. - Locale registry:
html-generators/locales.propertieslists supported locales (format:locale=Display name). The first entry is the default. - English is a first-class locale: All locales — including English — go through the same build pipeline.
- Fallback: If a pattern has no translation file for a locale, the English content is used and an "untranslated" banner is shown.
Defined in html-generators/locales.properties:
| Locale | Display Name |
|---|---|
en |
English |
es |
Español |
pt-BR |
Português (Brasil) |
Translation files contain only translatable fields — no structural data:
// translations/content/pt-BR/language/type-inference-with-var.json
{
"title": "Inferência de tipo com var",
"oldApproach": "Tipos explícitos",
"modernApproach": "Palavra-chave var",
"summary": "Use var para deixar o compilador inferir o tipo local.",
"explanation": "...",
"whyModernWins": [
{ "icon": "⚡", "title": "Menos ruído", "desc": "..." },
{ "icon": "👁", "title": "Mais legível", "desc": "..." },
{ "icon": "🔒", "title": "Seguro", "desc": "..." }
],
"support": {
"description": "Amplamente disponível desde o JDK 10 (março de 2018)"
}
}jbang html-generators/generate.java # Build HTML pages + snippets.json
jwebserver -d site -p 8090 # Serve locally