Eleven Hidden Gems In Java 11

This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).

Java 11 includes eleven lesser-known API additions worth knowing. String gains lines(), strip(), stripLeading(), stripTrailing(), isBlank(), and repeat(). Path gets a static of() factory method. Files adds readString() and writeString() for convenient whole-file I/O. InputStream, OutputStream, Reader, and Writer each get null/no-op factory methods. Collection gains a toArray(IntFunction) overload using constructor references. Optional adds isEmpty(). Predicate gets a static not() method for cleaner method reference negation. Pattern gains asMatchPredicate() for full-string matching. Lambda parameters can now use var, enabling annotations without spelling out full generic types.

11m read timeFrom nipafx.dev
Post cover image
Table of contents
▚ Eleven Gems▚ Reflection

Sort: