Thursday, 20 February 2025

stream API released after java 8

 

Java VersionFeatureDescription
Java 9takeWhile()Takes elements while condition is true
dropWhile()Drops elements while condition is true
ofNullable()Creates a stream with 0 or 1 element (handles null safely)
Java 10Collectors.toUnmodifiableList()Creates an immutable list
Java 11Stream.iterate() (With Predicate)Stops automatically based on condition
Java 12teeing()Merges results from two collectors
Java 16toList()Simplifies list collection
Java 17mapMulti()Alternative to flatMap(), more efficient

No comments:

Post a Comment