Java 12 Features
Java 12 Features: Teeing Collectors in Stream API Teeing Collector is the new collector utility introduced in the Streams API. This collector has three arguments – Two collectors and a Bi-function. Java Strings New Methods 4 new methods have been introduced in Java 12 which are: indent (int n) transform (Function f) Optional describeConstable () String resolveConstantDesc (MethodHandles.Lookup lookup) Pattern Matching for instanceof Compact Number Formatting Switch Expressions enhancements Java 12 has enhanced Switch expressions for Pattern matching. Introduced in JEP 325 , as a preview language feature, the new Syntax is L ->. Following are some things to note about Switch Expressions: The new Syntax removes the need for break statement to prevent fallthroughs. Switch Expressions don’t fall through anymore. Furthermore, we can define multiple constants in the same label. default case is now compulsory in Switch Expressions. break i...
Comments
Post a Comment