Bot releases are hidden (Show)
teeing
collector (from Java 12)mapMulti
operator for all streams and mapMultiToInt
, mapMultiToLong
, mapMultiToDouble
to object Stream
(from Java 16)findFirstOrElse(defaultValue)
, append(T)
, prepend(T)
to Stream
(thanks to @wjtxyz)concat
now supports 3+ streams or iteratorsSpinedBuffer
for objects. SpinedBuffer
now public, but it slightly differs from Java 8 API.dropWhile
, takeUntil
, filterIndexed
, mapIndexed
and scan
operators in primitive streamsPublished by aNNiMON about 6 years ago
ofNullable
for primitive Optionals (thanks to @mannodermaus)filterIndexed
, mapIndexed
, forEachIndexed
operators to primitive streams (thanks to @PromanSEW)isEmpty
method for Optionals (from Java 11)Published by aNNiMON over 6 years ago
Optional.mapToBoolean
(thanks to @bejibx)Stream.equalsOnly
operator (thanks to @operando)deepEquals
, requireNonNullElse
, requireNonNullElseGet
, isNull
, nonNull
and requireNonNullElements
methods to Objects
(thanks @ened for suggestion)orElseThrow()
method to Optional
classes. Please, prefer this method instead of get()
as it better reflects the behavior of the methodtoUnmodifiableList()
, toUnmodifiableSet()
and toUnmodifiableMap()
collectors from Java 10 (thanks to @javadev and @PromanSEW). See PromanSEW's comment
Collectors.toMap
implementation was changed to match Java 8 specs. toMap(keyMapper)
, toMap(keyMapper, valueMapper)
and toMap(keyMapper, valueMapper, mapFactory)
now disallows duplicate keys. If the mapped keys contain duplicates, use new toMap(keyMapper, valueMapper, mergeFunction)
and toMap(keyMapper, valueMapper, mergeFunction, mapFactory)
methodsFunctionalInterface
annotationStream.getIterator
methodPublished by aNNiMON about 7 years ago
filterNot
for OptionalsStream.merge
operator (thanks to @landawn)Stream.concat
for iteratorsStream.ofNullable
for array, map and iterator (thanks to @petnagy)Collectors.partitioningBy
getOrElse(Supplier)
, isPresent
and custom operators support for Exceptional
(thanks to @PromanSEW)Published by aNNiMON over 7 years ago
findIndexed
operator. Thanks to @PromanSEWCloseable
, close
and onClose
methods are added. Thanks to @frettofCodePoints
. Thanks to @arturogutierrezOptionalBoolean
and boolean functional interfaces. Thanks to @PromanSEWdistinctBy
and findLast
operators. Small optimization of distinct
operator. Thanks to @landawnOptionalBooleanMatcher
Published by aNNiMON over 7 years ago
Util.safe
converters. Thanks to @PromanSEWComparatorCompat
. Thanks to @BattleShipParkfilter
operator in primitive streams. Thanks to @RomainPielStream.ofRange
methods.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
StreamMatcher.elements
now uses Iterable
matcherStreamMatcher.isNotEmpty
methodPublished by aNNiMON over 7 years ago
Stream.withoutNulls()
Stream.nullsOnly()
and Predicate.Util.notNull()
. Thanks to @IlyaGulyaComparator
backport. Thanks to @BattleShipParkObjects.compareInt
and Objects.compareLong
— backport of Java 7 Integer.compare
and Long.compare
takeUntil
and scan
operatorsfilterIndexed
, mapIndexed
, takeWhileIndexed
, takeUntilIndexed
, dropWhileIndexed
, reduceIndexed
, forEachIndexed
and indexed functional interfaces.filter
, flatMap
, scan
and single
operators of primitive streams.Stream.concat
Added stream custom operator assertions:
Stream.range(1, 4).custom(assertElements(contains(1, 2, 3)))
Update mockito to 2.7.13
Published by aNNiMON over 7 years ago
Stream.ofNullable(T element)
and Stream.ofNullable(iterable)
methodsStream.toList()
which can be much faster and convenient than collect(Collectors.toList())
(thanks to @akonior for both great ideas)flatMap
iterator of primitive streamsStream.distinct()
iterate(T seed, Predicate p, UnaryOperator op)
method for all streamsPublished by aNNiMON almost 8 years ago
LongStream
and DoubleStream
OptionalLong
and OptionalDouble
Exceptional.of(Throwable)
factory method (thanks to @arturdm)mapToLong
, mapToDouble
, flatMapToLong
, flatMapToDouble
to Stream
mapToLong
, mapToDouble
to IntStream
mapToLong
, mapToDouble
to Optional
filter
, ifPresentOrElse
, mapToLong
and mapToDouble
methods to OptionalInt
longs
and doubles
methods to RandomCompat
IllegalArgumentException
in RandomCompat
ints
method, when bound is greater than max intIntStream
rangeClosed
deadlock on Integer.MAX_VALUE
boundStream
range
and rangeClosed
now uses IntStream
/LongStream
internallyIntStreamMatcher
, LongStreamMatcher
and DoubleStreamMatcher
OptionalLongMatcher
, OptionalDoubleMatcher
Published by aNNiMON almost 8 years ago
summingInt
, summingLong
, summingDouble
, averagingInt
, averagingLong
, averagingDouble
collectorsflatMapping
and filtering
collectors, which introduced in Java 9ToLongFunction
and ToDoubleFunction
interfacesOptional.mapToInt
, OptionalInt.map
and OptionalInt.mapToObj
methodsIntStream.single
, IntStream.findSingle
methodsCollectors.counting
now uses summingLong
to avoid unnecessary boxingCollectors.averaging
now deprecated and uses averagingDouble
internally, also fixed NaN result for empty streamPublished by aNNiMON about 8 years ago
distinct
method now preserves order (thanks to @pawelkw for having noticed this issue)
Improved error checking in sample
method
Added single
and findSingle
methods (thanks to @xsveda)
Added recover
and recoverWith
methods to Exceptional
(see #66)
Added executeIfPresent
and executeIfAbsent
methods to Optional
and OptionalInt
(see #68)
Added ifPresent
method to Exceptional
Ability to invoke zip
method with Iterator
to prevent unnecessary wraping to Stream
Added index
operator to Stream
Other fixes and improvements
Published by aNNiMON about 8 years ago
Added IntStream
, OptionalInt
and RandomCompat.ints()
. Many thanks to @andrey-shikhov for the great work!
Fixed Stream filter
causing infinite loop in some cases (issue #53)
Added mapToInt
and flatMapToInt
to Stream
Added stream
, or
methods to Optional
Added or
method to Exceptional
Stream getIterator
is now deprecated, use iterator()
instead
Removed method Stream.of(List)
. This may breaks binary compatibility!
LinkedList replaced with ArrayDeque in sample
, slidingWindow
methods for performance enhancement. Android 2.1 and 2.2 still uses LinkedList. See #61
Other fixes and optimizations
Added OptionalIntMatcher
Added hasValue
and hasValueThat
methods to OptionalMatcher
Now streamTest
library version matches stream
version
Published by aNNiMON over 8 years ago
Fixed compatibility with Android 2.1. Thanks to @andrey-shikhov
Added map
method to Exceptional
Added throwable functions and safe
method to convert them into normal functions
Added select
method to Optional. Thanks to @xsveda
Fixed Optional.isEmpty() matches against null value
Added StreamMatcher.hasElements()
Added OptionalMatcher for Mockito
Published by aNNiMON over 8 years ago
select(Class)
method to filter stream by type. Thanks to @andrey-shikhovfilterNot
methodstream-test:1.0.0
artifact with Hamcrest matchersPublished by aNNiMON over 8 years ago
Stream.zip
function. Thanks to @yprestochunkBy
and slidingWindow
operators. Thanks to @solderratakeWhile
and dropWhile
operatorsStream.empty()
Function.Util.compose
sorted
and distinct
lazinessPublished by aNNiMON over 8 years ago
toArray
methods. Thanks to @archinamonofRange
and ofRangeClosed
is now deprecated, use range
and rangeClosed
instead (see Java 8 IntStream
). Thanks to @ypresto for suggestionskip
laziness.Published by aNNiMON over 8 years ago
reduce
interface. Thanks to @WoppleT reduce(T identity, BiFunction<T, T, T> accumulator)
R reduce(R identity, BiFunction<? super R, ? super T, ? extends R> accumulator)
filter
and flatMap
operators, that breaks concat
results. Thanks to @kotuczPublished by aNNiMON almost 9 years ago
custom
method to Stream
for apply custom operators. See CustomOperators,java.rangeClosed
, concat
methods to Stream
Published by aNNiMON almost 9 years ago
toCollection
, toMap
, mapping
, reducing
, collectingAndThen
to Collectors
Published by aNNiMON about 9 years ago
groupingBy
, counting
, joining
with parameters (thanks to @fabioCollini) to Collectors
ThrowableSupplier
to use in lambda expressions without writing try/catch in its bodyExceptional
to operate throwable blocks in functional waygroupBy
and Scala-like sortBy
methods to Stream
Stream.generate
and Stream.iterate
methods