https://github.com/beryx/streamplify
Java 8 combinatorics-related streams and other utilities
https://github.com/beryx/streamplify
combination combinations combinatorics permutation permutations stream streams
Last synced: 10 months ago
JSON representation
Java 8 combinatorics-related streams and other utilities
- Host: GitHub
- URL: https://github.com/beryx/streamplify
- Owner: beryx
- License: apache-2.0
- Created: 2016-09-05T17:57:03.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-10T07:37:08.000Z (over 7 years ago)
- Last Synced: 2025-03-31T06:24:18.729Z (11 months ago)
- Topics: combination, combinations, combinatorics, permutation, permutations, stream, streams
- Language: Java
- Homepage: http://streamplify.beryx.org/
- Size: 1.42 MB
- Stars: 42
- Watchers: 9
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[](http://makeapullrequest.com)
[](https://github.com/beryx/streamplify/blob/master/LICENSE)
[](https://travis-ci.org/beryx/streamplify)
## Streamplify ##
The goal of this library is to provide useful Java 8 streams and to assist you in building new streams that allow efficient parallel processing.
The utilities offered by Streamplify include:
- combinatorics streams: permutations, combinations, Cartesian products, power sets, derangements, partial permutations.
- classes that help you implement your own efficient parallel streams.
**Example**
The following code snippet uses a parallel permutation stream to find all solutions of the [N-Queens problem](https://en.wikipedia.org/wiki/Eight_queens_puzzle) for n = 10.
```
System.out.println(new Permutations(10)
.parallelStream()
.filter(perm -> {
for(int i = 0; i < perm.length - 1; i++) {
for(int j = i + 1; j < perm.length; j++) {
if(Math.abs(perm[j] - perm[i]) == j - i) return false;
}
}
return true;
})
.map(perm -> IntStream.range(0, perm.length)
.mapToObj(i -> "(" + (i + 1) + "," + (perm[i] + 1) + ")")
.collect(Collectors.joining(", ")))
.collect(Collectors.joining("\n")));
```
Before starting to use the library, take a look at the **[examples](streamplify-examples/src/main/java/org/beryx/streamplify/example)**, read the **[documentation](http://streamplify.beryx.org)** and consult the **[javadoc](http://streamplify.beryx.org/releases/latest/javadoc)**.
Streamplify is available in [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.beryx%22%20AND%20a%3A%22streamplify%22) and [JCenter](https://bintray.com/beryx/maven/streamplify).
**Contribute to this project!**
We accept all types of contributions and we are very welcoming to first time contributors.
Read **[how to contribute](CONTRIBUTING.md)** and jump in!