package codesample.java10;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class NewStuffJavaTen {
    public static void main(String[] args) {

        /* Type-inference (Note: does not work for non-local variables, array initializers,
        lambdas (when you create lambda. Returning result into var is OK) */
        var message = "Hello, world!";
        System.out.println(message);

        // Note: This will be array list of Objects
        var empList = new ArrayList<>();

        /* copyOf for collections */
        var list = List.of(1,2,3);
        var copy = List.copyOf(list);

        /* unmodifiable collections on collectors*/
        var set = copy.stream()
                .map(value -> value * 3)
                .collect(Collectors.toUnmodifiableSet());

        /* orElseThrow without arguments throws NoSuchElementException */
        var oneElementList = List.of(5);
        var onlyElement = oneElementList.stream()
                .filter(value -> value > 3)
                .findFirst()
                .orElseThrow();
    }
}

@@ -45,24 +45,54 @@
 .ArrayList;%0A
+import java.util.Collections;%0A
 import java.
@@ -98,24 +98,24 @@
 .util.List;%0A
-
 import java.
@@ -137,16 +137,48 @@
 lectors;
+%0Aimport java.util.stream.Stream;
 %0A%0Apublic
@@ -456,16 +456,67 @@
 orld!%22;%0A
+%0A%0A        var %D0%BA%D1%83%D0%BA%D0%B0%D1%80%D0%B5%D0%BA%D1%83 = new %D0%9A%D1%83%D0%BA%D0%B0%D1%80%D0%B5%D0%BA%D1%83%3C%D0%9A%D1%83%D0%BA%D0%B0%D1%80%D0%B5%D0%BA%3E();%0A%0A
         
@@ -1172,16 +1172,16 @@
 First()%0A
-
         
@@ -1203,16 +1203,767 @@
 Throw();
+%0A%0A        var var = Var.var();%0A        var.var().var().var().var();%0A%0A        var listOfInt = new ArrayList%3CInteger%3E(List.of(1,2,3));%0A        var copyy = Collections.unmodifiableList(listOfInt);%0A        System.out.println(copyy);%0A        listOfInt.add(4);%0A        System.out.println(copyy);%0A    %7D%0A%0A%0A    public interface Animal %7B%7D%0A    public interface Cat extends Animal %7B void meow(); %7D%0A    public interface Dog extends Animal %7B void woof(); %7D%0A%0A    void makeSound(Animal animal) %7B%0A        var catDog = (Cat & Dog) animal;%0A        catDog.meow();%0A        catDog.woof();%0A    %7D%0A%0A    static class %D0%9A%D1%83%D0%BA%D0%B0%D1%80%D0%B5%D0%BA%D1%83%3CT%3E %7B%0A%0A    %7D%0A%0A    static class %D0%9A%D1%83%D0%BA%D0%B0%D1%80%D0%B5%D0%BA %7B%0A%0A    %7D%0A%0A    public static class Var %7B%0A        public static Var var() %7B%0A            return new Var();%0A        %7D
 %0A    %7D%0A%7D

Add new java 10 code