stream-goodies

Java Goodies for functional programming

License

License

GroupId

GroupId

org.danilopianini
ArtifactId

ArtifactId

stream-extensions
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

stream-goodies
Java Goodies for functional programming
Project URL

Project URL

https://github.com/DanySK/stream-goodies
Source Code Management

Source Code Management

https://github.com/DanySK/stream-goodies

Download stream-extensions

How to add to project

<!-- https://jarcasting.com/artifacts/org.danilopianini/stream-extensions/ -->
<dependency>
    <groupId>org.danilopianini</groupId>
    <artifactId>stream-extensions</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.danilopianini/stream-extensions/
implementation 'org.danilopianini:stream-extensions:0.1.0'
// https://jarcasting.com/artifacts/org.danilopianini/stream-extensions/
implementation ("org.danilopianini:stream-extensions:0.1.0")
'org.danilopianini:stream-extensions:jar:0.1.0'
<dependency org="org.danilopianini" name="stream-extensions" rev="0.1.0">
  <artifact name="stream-extensions" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.danilopianini', module='stream-extensions', version='0.1.0')
)
libraryDependencies += "org.danilopianini" % "stream-extensions" % "0.1.0"
[org.danilopianini/stream-extensions "0.1.0"]

Dependencies

compile (1)

Group / Artifact Type Version
com.google.guava : guava jar [r08, 21.0]

Project Modules

There are no modules declared in this project.

Boilerplate

Collection of boilerplate code that should ease writing Java 8+ code

Status

Stable branch

Build Status

Development branch

Build Status

Usage

Hashes

Murmur3-based hashing for arbitrary objects.

FastReadWriteLock

Implements a multiple-reader / single-writer lock relying on a single semaphore. Writers lock with write(), readers lock with read(). Both release the lock with release(). The lock must be used correctly by the programmer (releases made randomly are unchecked, and will break the locking system). Non-reentrant (calling write() twice produces a deadlock).

PrimitiveArrays

A set of utility methods for changing (through copy) the type of arrays. Allows for both widening and narrowing "casts" (with precision loss).

Streams.flatten

Flattens a recursive, hierarchical data structure to a Stream.

For instance:

Tree tree = new MyTree();
TreeNode root = tree.getRoot();
Stream<TreeNode> s = Streams.flatten(root, t -> t.getChildren().stream())

Would traverse the tree breadth-first.

SmallestN

A collector that efficiently selects the desired number of smallest elements from the stream. Returns a Guava MinMaxPriorityQueue, that is used to efficiently store only the required elements. This collector has in general better performance than the equivalent .sort().limit().collect() chain.

Import in your project

I warmly suggest to use Gradle, Maven or a similar system to deal with dependencies within your project. In this case, you can use this product by importing the following Maven dependency:

<dependency>
    <groupId>org.danilopianini</groupId>
    <artifactId>boilerplate</artifactId>
    <version>VERSION_YOU_WANT_TO_USE</version>
</dependency>

or the following Gradle dependency:

compile 'org.danilopianini:boilerplate:VERSION_YOU_WANT_TO_USE'

Alternatively, you can grab the latest jar and throw it in your classpath. In this case, be sure to include the dependencies of this project in your classpath as well.

Versions

Version
0.1.0