rel:: [[Programming Languages]] # Java ## Reference - see [[JVM]] - New Language Feature - [wesleyegberto/java-new-features](https://github.com/wesleyegberto/java-new-features) - [Pattern Matching](https://dev.java/learn/pattern-matching/) ([permalink](https://readwise.io/reader/shared/01gnd15z5ywrb52ga6ccwd1qxq)) - [Allocation Lifetimes in the Foreign Function & Memory API](https://readwise.io/reader/shared/01gqv68mn11ty0vb3enwn96k6r) - [Tiered compilation and containers](https://readwise.io/reader/shared/01gnzpexy6k219w0r90x1wd4t8) ### Releases - [Java 19](https://blogs.oracle.com/java/post/the-arrival-of-java-19) - [Java 18](https://blogs.oracle.com/java/post/the-arrival-of-java-18) - [Java 17](https://blogs.oracle.com/java/post/announcing-java17) ## Cookbook ### Self recursive local / fixed point combinator ```java public static interface Recursable<T, U> { U apply(T t, Recursable<T, U> r); } public static <T, U> Function<T, U> recurse(Recursable<T, U> f) { return t -> f.apply(t, f); } public interface BiRecursable<T, U, R> { R apply(T t, U u, BiRecursable<T, U, R> r); } public static <T, U, R> BiFunction<T, U, R> recurse(BiRecursable<T, U, R> f) { return (t, u) -> f.apply(t, u, f); } // ... and used as Function<Integer, Double> fact = recurse( (i, f) -> 0 == i ? 1 : i * f.apply(i - 1, f)); ``` ## Cool Projects ### Quarkus - https://quarkus.io - [[GraalVM]] - RedHat - fast cycle time, hot reloads in container - fast starting - [Faster, Lower, Better with Quarkus in k8s](https://itnext.io/faster-lower-better-with-quarkus-in-k8s-83185af46f36) ### microhttp [source](https://github.com/ebarlas/microhttp) > Microhttp is a fast, scalable, event-driven, self-contained Java web server that is small enough for a programmer to understand and reason about. > Comprehensibility is the highest priority. This library is intended to be an alternative to commonly used frameworks with overwhelming complexity. Implementation decisions aim to strike a balance between simplicity and efficiency. #### Principles - No dependencies - Small, targeted codebase (~500 LOC) - Highly concurrent - Single threaded - Event-driven non-blocking NIO - Traceability via log events #### Includes - HTTP 1.0 and 1.1 - Chunked transfer encoding - Persistent connections - Pipelining #### Excludes These can be provided by an edge proxy - HTTP 2 (provided by edge proxy) - Range requests - Caching - Compression - streaming - TLS