Releases: aNNiMON/Lightweight-Stream-API
Releases · aNNiMON/Lightweight-Stream-API
v1.2.2
- Added
teeing
collector (from Java 12) - Added
mapMulti
operator for all streams andmapMultiToInt
,mapMultiToLong
,mapMultiToDouble
to objectStream
(from Java 16) - Added
findFirstOrElse(defaultValue)
,append(T)
,prepend(T)
toStream
(thanks to @wjtxyz) concat
now supports 3+ streams or iterators- Added
SpinedBuffer
for objects.SpinedBuffer
now public, but it slightly differs from Java 8 API. - Fixed unnecessary unboxing of
dropWhile
,takeUntil
,filterIndexed
,mapIndexed
andscan
operators in primitive streams - Methods marked with nullability annotations
- Many other improvements
v1.2.1
- Added
ofNullable
for primitive Optionals (thanks to @mannodermaus) - Added
filterIndexed
,mapIndexed
,forEachIndexed
operators to primitive streams (thanks to @PromanSEW) - Added an ability to combine multiple predicates (thanks to @SunnyJithin for suggestion)
- Added
isEmpty
method for Optionals (from Java 11)
v1.2.0
- Added
Optional.mapToBoolean
(thanks to @bejibx) - Added
Stream.equalsOnly
operator (thanks to @operando) - Added
deepEquals
,requireNonNullElse
,requireNonNullElseGet
,isNull
,nonNull
andrequireNonNullElements
methods toObjects
(thanks @ened for suggestion) - Added
orElseThrow()
method toOptional
classes. Please, prefer this method instead ofget()
as it better reflects the behavior of the method - Added
toUnmodifiableList()
,toUnmodifiableSet()
andtoUnmodifiableMap()
collectors from Java 10 (thanks to @javadev and @PromanSEW). See PromanSEW's comment - The
Collectors.toMap
implementation was changed to match Java 8 specs.toMap(keyMapper)
,toMap(keyMapper, valueMapper)
andtoMap(keyMapper, valueMapper, mapFactory)
now disallows duplicate keys. If the mapped keys contain duplicates, use newtoMap(keyMapper, valueMapper, mergeFunction)
andtoMap(keyMapper, valueMapper, mergeFunction, mapFactory)
methods - Removed useless
FunctionalInterface
annotation - Removed deprecated
Stream.getIterator
method
v1.1.9
- Added custom operators for Optionals (thanks to @dr-projectiro for suggestion)
- Added
filterNot
for Optionals - Added
Stream.merge
operator (thanks to @landawn) - Added
Stream.concat
for iterators - Added
Stream.ofNullable
for array, map and iterator (thanks to @petnagy) - Added
Collectors.partitioningBy
- Added
getOrElse(Supplier)
,isPresent
and custom operators support forExceptional
(thanks to @PromanSEW)
v1.1.8
- Added
findIndexed
operator. Thanks to @PromanSEW - Added an ability to run action after closing streams. Stream classes now implements
Closeable
,close
andonClose
methods are added. Thanks to @frett
Notice that it is not necessary to close all streams. Please, refer to official Stream API documentation: https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html - Added IntStream
ofCodePoints
. Thanks to @arturogutierrez - Added
OptionalBoolean
and boolean functional interfaces. Thanks to @PromanSEW - Added
distinctBy
andfindLast
operators. Small optimization ofdistinct
operator. Thanks to @landawn
streamTest
- Added
OptionalBooleanMatcher
v1.1.7
- Added primitive throwable interfaces and
Util.safe
converters. Thanks to @PromanSEW - Improved comparators chaining in
ComparatorCompat
. Thanks to @BattleShipPark - Fixed
filter
operator in primitive streams. Thanks to @romainpiel - Removed deprecated
Stream.ofRange
methods. - Iterators moved to separate package.
Warning
If you're using PrimitiveIterator
, PrimitiveExtIterator
or LsaExtIterator
to create own custom operators, please, fix imports:
// Before
import com.annimon.stream.PrimitiveIterator;
import com.annimon.stream.LsaExtIterator;
// After
import com.annimon.stream.iterator.PrimitiveIterator;
import com.annimon.stream.iterator.LsaExtIterator;
If you're using ComparatorCompat.chain
, see #110
streamTest
StreamMatcher.elements
now usesIterable
matcher- Removed deprecated
StreamMatcher.isNotEmpty
method
v1.1.6
- Added
Stream.withoutNulls()
Stream.nullsOnly()
andPredicate.Util.notNull()
. Thanks to @IlyaGulya - Added Java 8
Comparator
backport. Thanks to @BattleShipPark - Added
Objects.compareInt
andObjects.compareLong
— backport of Java 7Integer.compare
andLong.compare
- Added
takeUntil
andscan
operators - Added indexed operators:
filterIndexed
,mapIndexed
,takeWhileIndexed
,takeUntilIndexed
,dropWhileIndexed
,reduceIndexed
,forEachIndexed
and indexed functional interfaces.
Many thanks to @dalewking for help and suggestions. - Fixed unnecessary boxing in
filter
,flatMap
,scan
andsingle
operators of primitive streams. - Reduced calls to first iterator in
Stream.concat
- Stream operators now placed into named classes in separate package. It can speed up the execution and improve stack trace readability. See an example.
- Many other fixes and improvements.
streamTest
-
Added stream custom operator assertions:
Stream.range(1, 4).custom(assertElements(contains(1, 2, 3)))
-
Update mockito to 2.7.13
v1.1.5
- Added
Stream.ofNullable(T element)
andStream.ofNullable(iterable)
methods - Added
Stream.toList()
which can be much faster and convenient thancollect(Collectors.toList())
(thanks to @akonior for both great ideas) - Fixed NPE in
flatMap
iterator of primitive streams - New faster implementation of
Stream.distinct()
- Added
iterate(T seed, Predicate p, UnaryOperator op)
method for all streams
v1.1.4
- Added
LongStream
andDoubleStream
- Added
OptionalLong
andOptionalDouble
- Added functional interfaces for operating with long and double primitive types
- Added
Exceptional.of(Throwable)
factory method (thanks to @arturdm) - Added
mapToLong
,mapToDouble
,flatMapToLong
,flatMapToDouble
toStream
- Added
mapToLong
,mapToDouble
toIntStream
- Added
mapToLong
,mapToDouble
toOptional
- Added
filter
,ifPresentOrElse
,mapToLong
andmapToDouble
methods toOptionalInt
- Added
longs
anddoubles
methods toRandomCompat
- Fixed
IllegalArgumentException
inRandomCompat
ints
method, when bound is greater than max int - Fixed
IntStream
rangeClosed
deadlock onInteger.MAX_VALUE
bound Stream
range
andrangeClosed
now usesIntStream
/LongStream
internally- Removed unnecessary abstraction in primitive streams
- Small other optimizations and javadocs fixes
streamTest
- Added
IntStreamMatcher
,LongStreamMatcher
andDoubleStreamMatcher
- Added
OptionalLongMatcher
,OptionalDoubleMatcher
- Updated mockito version to 2.2.17
v1.1.3
- Added
summingInt
,summingLong
,summingDouble
,averagingInt
,averagingLong
,averagingDouble
collectors - Added
flatMapping
andfiltering
collectors, which introduced in Java 9 - Added
ToLongFunction
andToDoubleFunction
interfaces - Added
Optional.mapToInt
,OptionalInt.map
andOptionalInt.mapToObj
methods - Added
IntStream.single
,IntStream.findSingle
methods Collectors.counting
now usessummingLong
to avoid unnecessary boxingCollectors.averaging
now deprecated and usesaveragingDouble
internally, also fixed NaN result for empty stream- Improved JavaDocs