Java Generics example This code uses Switch Expressions and Pattern Matching for instanceof introduced in Java 14 and 16. Run tests with mvn test