diff --git a/lang/pom.xml b/lang/pom.xml
new file mode 100644
index 0000000..1fa88c0
--- /dev/null
+++ b/lang/pom.xml
@@ -0,0 +1,23 @@
+
+
+
+ java-cookbook
+ fr.gasser
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ core
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+
+
+
\ No newline at end of file
diff --git a/lang/src/main/java/patternmatching/Main.java b/lang/src/main/java/patternmatching/Main.java
new file mode 100644
index 0000000..cdaa70d
--- /dev/null
+++ b/lang/src/main/java/patternmatching/Main.java
@@ -0,0 +1,72 @@
+package patternmatching;
+
+import java.io.FileNotFoundException;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.function.Consumer;
+
+public class Main {
+
+ private static class CustomObject {
+
+ private int a;
+
+ CustomObject(int a) {
+ this.a = a;
+ }
+
+ @Override
+ public String toString() {
+ return "CustomObject{" +
+ "a=" + a +
+ '}';
+ }
+ }
+
+ private static String formatObject(Object o) {
+ if (o instanceof Integer) return "int " + o;
+ if (o instanceof Byte) return "byte " + o;
+ if (o instanceof Double) return "double " + o;
+ if (o instanceof String) return "string " + o;
+ return String.format("Object %s", o);
+ }
+
+ private static long[] runNTimes(int numberOfRuns, Object[] toTest, Consumer super Object> code) {
+ long runs[] = new long[numberOfRuns];
+ for (int i = 0; i < numberOfRuns; i++) {
+ long startTime = System.nanoTime();
+ Arrays.stream(toTest).forEach(code);
+ long endTime = System.nanoTime();
+ long duration = (endTime - startTime);
+ runs[i] = duration;
+ }
+
+ return runs;
+ }
+
+ public static void main(String[] args) {
+ Object[] toTest = {"Hello", 1.2, new CustomObject(5)};
+
+ final PatternMatcher