Skip to content

Releases: aNNiMON/Lightweight-Stream-API

v1.2.2

20 Mar 19:51
Compare
Choose a tag to compare
  • Added teeing collector (from Java 12)
  • Added mapMulti operator for all streams and mapMultiToInt, mapMultiToLong, mapMultiToDouble to object Stream (from Java 16)
  • Added findFirstOrElse(defaultValue), append(T), prepend(T) to Stream (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 and scan operators in primitive streams
  • Methods marked with nullability annotations
  • Many other improvements

v1.2.1

25 Jul 09:46
Compare
Choose a tag to compare
  • 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

12 Apr 18:59
Compare
Choose a tag to compare
  • Added Optional.mapToBoolean (thanks to @bejibx)
  • Added Stream.equalsOnly operator (thanks to @operando)
  • Added deepEquals, requireNonNullElse, requireNonNullElseGet, isNull, nonNull and requireNonNullElements methods to Objects (thanks @ened for suggestion)
  • Added orElseThrow() method to Optional classes. Please, prefer this method instead of get() as it better reflects the behavior of the method
  • Added toUnmodifiableList(), toUnmodifiableSet() and toUnmodifiableMap() 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) 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) methods
  • Removed useless FunctionalInterface annotation
  • Removed deprecated Stream.getIterator method

v1.1.9

20 Sep 08:46
Compare
Choose a tag to compare
  • 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 for Exceptional (thanks to @PromanSEW)

v1.1.8

24 Jun 08:54
Compare
Choose a tag to compare
  • Added findIndexed operator. Thanks to @PromanSEW
  • Added an ability to run action after closing streams. Stream classes now implements Closeable, close and onClose 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 and findLast operators. Small optimization of distinct operator. Thanks to @landawn

streamTest

  • Added OptionalBooleanMatcher

v1.1.7

24 Mar 18:15
Compare
Choose a tag to compare
  • 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 uses Iterable matcher
  • Removed deprecated StreamMatcher.isNotEmpty method

v1.1.6

01 Mar 09:24
Compare
Choose a tag to compare
  • Added Stream.withoutNulls() Stream.nullsOnly() and Predicate.Util.notNull(). Thanks to @IlyaGulya
  • Added Java 8 Comparator backport. Thanks to @BattleShipPark
  • Added Objects.compareInt and Objects.compareLong — backport of Java 7 Integer.compare and Long.compare
  • Added takeUntil and scan 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 and single 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

30 Jan 12:03
Compare
Choose a tag to compare
  • Added Stream.ofNullable(T element) and Stream.ofNullable(iterable) methods
  • Added Stream.toList() which can be much faster and convenient than collect(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

26 Nov 20:32
Compare
Choose a tag to compare
  • Added LongStream and DoubleStream
  • Added OptionalLong and OptionalDouble
  • 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 to Stream
  • Added mapToLong, mapToDouble to IntStream
  • Added mapToLong, mapToDouble to Optional
  • Added filter, ifPresentOrElse, mapToLong and mapToDouble methods to OptionalInt
  • Added longs and doubles methods to RandomCompat
  • Fixed IllegalArgumentException in RandomCompat ints method, when bound is greater than max int
  • Fixed IntStream rangeClosed deadlock on Integer.MAX_VALUE bound
  • Stream range and rangeClosed now uses IntStream/LongStream internally
  • Removed unnecessary abstraction in primitive streams
  • Small other optimizations and javadocs fixes

streamTest

  • Added IntStreamMatcher, LongStreamMatcher and DoubleStreamMatcher
  • Added OptionalLongMatcher, OptionalDoubleMatcher
  • Updated mockito version to 2.2.17

v1.1.3

22 Oct 14:46
Compare
Choose a tag to compare
  • Added summingInt, summingLong, summingDouble, averagingInt, averagingLong, averagingDouble collectors
  • Added flatMapping and filtering collectors, which introduced in Java 9
  • Added ToLongFunction and ToDoubleFunction interfaces
  • Added Optional.mapToInt, OptionalInt.map and OptionalInt.mapToObj methods
  • Added IntStream.single, IntStream.findSingle methods
  • Collectors.counting now uses summingLong to avoid unnecessary boxing
  • Collectors.averaging now deprecated and uses averagingDouble internally, also fixed NaN result for empty stream
  • Improved JavaDocs