protonpack alternatives and similar libraries
Based on the "Functional Programming" category.
Alternatively, view protonpack alternatives based on common mentions on social networks and blogs.
8.3 5.3 L3 protonpack VS Javaslangvʌvr (formerly called Javaslang) is a non-commercial, non-profit object-functional library that runs with Java 8+. It aims to reduce the lines of code and increase code quality.
6.8 0.0 L2 protonpack VS jOOλjOOλ - The Missing Parts in Java 8 jOOλ improves the JDK libraries in areas where the Expert Group's focus was elsewhere. It adds tuple support, function support, and a lot of additional functionality around sequential Streams. The JDK 8's main efforts (default methods, lambdas, and the Stream API) were focused around maintaining backwards compatibility and implementing a functional API for parallelism.
6.1 0.0 L3 protonpack VS cyclops-reactAn advanced, but easy to use, platform for writing functional applications in Java 8.
4.6 0.0 L4 protonpack VS derive4jJava 8 annotation processor and framework for deriving algebraic data types constructors, pattern-matching, folds, optics and typeclasses.
2.8 7.1 L5 protonpack VS Faux PasA library that simplifies error handling for Functional Programming in Java
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of protonpack or a related project?
A small collection of
Stream utilities for Java 8. Protonpack provides the following:
For full API documentation, see (http://poetix.github.io/protonpack).
Available from Maven Central:
<dependency> <groupId>com.codepoetics</groupId> <artifactId>protonpack</artifactId> <version>1.16</version> </dependency>
Takes elements from the stream while the supplied condition is met.
takeUntil does the same, but with the condition negated.
Stream<Integer> infiniteInts = Stream.iterate(0, i -> i + 1); Stream<Integer> finiteInts = StreamUtils.takeWhile(infiniteInts, i -> i < 10); assertThat(finiteInts.collect(Collectors.toList()), hasSize(10));
Skips elements from the stream while the supplied condition is met.
skipUntil does the same, but with the condition negated.
Stream<Integer> ints = Stream.of(1,2,3,4,5,6,7,8,9,10); Stream<Integer> skipped = StreamUtils.skipWhile(ints, i -> i < 4); List<Integer> collected = skipped.collect(Collectors.toList()); assertThat(collected, contains(4, 5, 6, 7, 8, 9, 10));
Combines two streams using the supplied combiner function.
Stream<String> streamA = Stream.of("A", "B", "C"); Stream<String> streamB = Stream.of("Apple", "Banana", "Carrot", "Doughnut"); List<String> zipped = StreamUtils.zip(streamA, streamB, (a, b) -> a + " is for " + b) .collect(Collectors.toList()); assertThat(zipped, contains("A is for Apple", "B is for Banana", "C is for Carrot"));
Generates a (potentially infinite) stream using a generator that can indicate the end of the stream at any time by returning Optional.empty().
Stream<Integer> unfolded = StreamUtils.unfold(1, i -> (i < 10) ? Optional.of(i + 1) : Optional.empty()); assertThat(unfolded.collect(Collectors.toList()), contains(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
Transforms a source type into a stream
Stream<Item> items = idStream.flatMap(id -> StreamUtils.stream(fetchItem(id));
Streamable is to Stream as Iterable is to Iterator. Useful when you will want to stream repeatedly over some source.
A collector that returns the one and only item in a stream, if present, or throws an exception if multiple items are found.
assertThat(Stream.of(1, 2, 3).filter(i -> i > 3).collect(CollectorUtils.unique()), equalTo(Optional.empty())); assertThat(Stream.of(1, 2, 3).filter(i -> i > 2).collect(CollectorUtils.unique()), equalTo(Optional.of(3))); // Throws NonUniqueValueException Stream.of(1, 2, 3).filter(i -> i > 1).collect(CollectorUtils.unique());
A collector that converts a stream of
CompletableFuture<T> into a
CompletableFuture<List<T>>, which completes
exceptionally if (and as soon as) any of the futures in the list completes exceptionally.
Function<Integer, CompletableFuture<Integer>> processAsynchronously = i -> CompletableFuture.completedFuture(i * 2); assertThat( Stream.of(1, 2, 3).map(processAsynchronously) .collect(CompletableFutures.toFutureList()) .get(), contains(2, 4, 6));