diff --git a/.github/tools/pom.xml b/.github/tools/pom.xml
new file mode 100644
index 0000000..4574d9b
--- /dev/null
+++ b/.github/tools/pom.xml
@@ -0,0 +1,69 @@
+
+
+ 4.0.0
+ tools
+ 1.0.0
+ dev.playground
+
+
+ UTF-8
+ 21
+ 21
+ dev.playground.tools.IndexJson
+ 5.9.2
+
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ ${junit.version}
+ compile
+
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ ${junit.version}
+ compile
+
+
+ org.junit.jupiter
+ junit-jupiter-api
+ ${junit.version}
+ compile
+
+
+
+
+
+
+ maven-jar-plugin
+ 3.0.2
+
+
+
+ true
+ ${mainClass}
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.11.0
+
+ ${maven.compiler.source}
+ ${maven.compiler.target}
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.22.1
+
+
+
+
diff --git a/.github/tools/src/main/java/dev/playground/tools/IndexJson.java b/.github/tools/src/main/java/dev/playground/tools/IndexJson.java
new file mode 100644
index 0000000..7e6d107
--- /dev/null
+++ b/.github/tools/src/main/java/dev/playground/tools/IndexJson.java
@@ -0,0 +1,43 @@
+package dev.playground.tools;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.stream.Collectors;
+
+public class IndexJson {
+
+ static final String rawGithubCDNPrefix = "https://raw.githubusercontent.com/java/playground-snippets/main/";
+
+ public static void main(String[] args) throws IOException {
+ if (args.length < 1) {
+ System.err.println("USAGE:\n\t[program] ");
+ System.exit(1);
+ }
+ var strPath = args[0];
+ var path = Path.of(strPath);
+ if (!path.toFile().exists()) {
+ System.err.printf("Directory %s does not exist!\nUSAGE:\n\t[program] \n", path);
+ System.exit(1);
+ }
+
+ String result;
+ try(var walker = Files.walk(path)) {
+ result = walker.filter(f -> !Files.isDirectory(f)).map(key -> {
+ var strKey = key.toString().replace(strPath + "/", "");
+ var strValue = rawGithubCDNPrefix + strKey;
+
+ return String.format("\t\"%s\": \"%s\"", strKey, strValue);
+ }).collect(Collectors.joining(",\n"));
+ }
+ var indexJsonContent = String.format("{\n%s\n}", result);
+ var indexJsonFilePath = Path.of(strPath, "index.json");
+ System.out.println(indexJsonFilePath);
+ Files.deleteIfExists(indexJsonFilePath);
+ indexJsonFilePath.toFile().createNewFile();
+
+ Files.writeString(indexJsonFilePath, indexJsonContent);
+ System.out.println(indexJsonContent);
+ }
+}
diff --git a/.github/tools/src/main/resources/README.md b/.github/tools/src/main/resources/README.md
new file mode 100644
index 0000000..9d4fa1c
--- /dev/null
+++ b/.github/tools/src/main/resources/README.md
@@ -0,0 +1,4 @@
+# DISCLAIMER
+
+
+[snippets](snippets) is a symlink to a [root folder](../../../../../snippets).
diff --git a/.github/tools/src/main/resources/snippets/hello-world.snippet b/.github/tools/src/main/resources/snippets/hello-world.snippet
new file mode 100644
index 0000000..d83ace4
--- /dev/null
+++ b/.github/tools/src/main/resources/snippets/hello-world.snippet
@@ -0,0 +1,3 @@
+var name = "Duke";
+
+System.out.println("Hello, " + name);
diff --git a/.github/tools/src/main/resources/snippets/index.json b/.github/tools/src/main/resources/snippets/index.json
new file mode 100644
index 0000000..dd4439a
--- /dev/null
+++ b/.github/tools/src/main/resources/snippets/index.json
@@ -0,0 +1,20 @@
+{
+ "misc/simple-collection.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/misc/simple-collection.snippet",
+ "misc/func-interface.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/misc/func-interface.snippet",
+ "misc/functions-chaining.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/misc/functions-chaining.snippet",
+ "records/composing.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/records/composing.snippet",
+ "records/simple.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/records/simple.snippet",
+ "records/method-overriding.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/records/method-overriding.snippet",
+ "streams/filtering.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/streams/filtering.snippet",
+ "streams/stream-to-list.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/streams/stream-to-list.snippet",
+ "streams/text-block-to-stream.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/streams/text-block-to-stream.snippet",
+ "textblocks/formatting.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/textblocks/formatting.snippet",
+ "textblocks/simple.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/textblocks/simple.snippet",
+ "textblocks/record.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/textblocks/record.snippet",
+ "hello-world.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/hello-world.snippet",
+ "switch/expression.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/switch/expression.snippet",
+ "switch/pattern-matching.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/switch/pattern-matching.snippet",
+ "switch/statement.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/switch/statement.snippet",
+ "pattern-matching/record.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/pattern-matching/record.snippet",
+ "pattern-matching/switch.snippet": "https://raw.githubusercontent.com/java/playground-snippets/main/pattern-matching/switch.snippet"
+}
\ No newline at end of file
diff --git a/.github/tools/src/main/resources/snippets/misc/func-interface.snippet b/.github/tools/src/main/resources/snippets/misc/func-interface.snippet
new file mode 100644
index 0000000..1f8db85
--- /dev/null
+++ b/.github/tools/src/main/resources/snippets/misc/func-interface.snippet
@@ -0,0 +1,9 @@
+@FunctionalInterface
+interface MyFunctionalInterface {
+ public int incrementByTwo(int a);
+}
+
+MyFunctionalInterface f = (num) -> num + 2;
+var result = f.incrementByTwo(40);
+
+System.out.println(result);
diff --git a/.github/tools/src/main/resources/snippets/misc/functions-chaining.snippet b/.github/tools/src/main/resources/snippets/misc/functions-chaining.snippet
new file mode 100644
index 0000000..cb53b20
--- /dev/null
+++ b/.github/tools/src/main/resources/snippets/misc/functions-chaining.snippet
@@ -0,0 +1,9 @@
+var strings = Arrays.asList("one", null, "three", "", "five", "six");
+
+Function handleNull = s -> s == null ? "": s;
+Function length = s -> s.length();
+Function handleNullThenLength = handleNull.andThen(length);
+
+for (String string : strings) {
+ System.out.println(string + " -> length = " + handleNullThenLength.apply(string));
+}
diff --git a/.github/tools/src/main/resources/snippets/misc/simple-collection.snippet b/.github/tools/src/main/resources/snippets/misc/simple-collection.snippet
new file mode 100644
index 0000000..d3f735f
--- /dev/null
+++ b/.github/tools/src/main/resources/snippets/misc/simple-collection.snippet
@@ -0,0 +1,6 @@
+Collection numbers = new ArrayList<>();
+numbers.add("one");
+numbers.add("two");
+numbers.add("three");
+numbers.remove("two");
+System.out.println(numbers);
diff --git a/.github/tools/src/main/resources/snippets/pattern-matching/record.snippet b/.github/tools/src/main/resources/snippets/pattern-matching/record.snippet
new file mode 100644
index 0000000..cec18ca
--- /dev/null
+++ b/.github/tools/src/main/resources/snippets/pattern-matching/record.snippet
@@ -0,0 +1,14 @@
+record Point(int x, int y) {
+ public boolean equals(Object other) {
+ return other instanceof Point otherPoint &&
+ this.x == otherPoint.x && this.y == otherPoint.y;
+ }
+}
+
+Point p1 = new Point(0, 0);
+Point p2 = new Point(1, 1);
+Point p3 = new Point(0, 0);
+System.out.println("p1 equals object? " + p1.equals(new Object()));
+System.out.println("p1 equals p2? " + p1.equals(p2));
+System.out.println("p1 equals p3? " + p1.equals(p3));
+System.out.println("p2 equals p3? " + p2.equals(p3));
diff --git a/.github/tools/src/main/resources/snippets/pattern-matching/switch.snippet b/.github/tools/src/main/resources/snippets/pattern-matching/switch.snippet
new file mode 100644
index 0000000..b6f622b
--- /dev/null
+++ b/.github/tools/src/main/resources/snippets/pattern-matching/switch.snippet
@@ -0,0 +1,23 @@
+record Point(int x, int y) {}
+
+record Circle(Point center, int radius) {
+ public Circle {
+ if (radius < 0) throw new IllegalArgumentException("Radius cant be null");
+ }
+}
+
+ToDoubleFunction