Need help with ixjava?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

akarnokd
210 Stars 7 Forks Apache License 2.0 105 Commits 0 Opened issues

Description

Iterable Extensions for Java 6+

Services available

!
?

Need anything else?

Contributors list

# 587
Java
rxjava
reactiv...
C#
97 commits
# 248,062
iterabl...
CSS
Shell
java8
2 commits
# 1,584
image-f...
assembl...
netfram...
residua...
2 commits

ixjava

codecov.io Maven Central

Iterable Extensions for Java, the dual of RxJava. Originally implemented in the Reactive4Java framework, now standalone; no dependencies on any reactive library.

The aim is to provide, lazily evaluated, pull-based datastream support with the same naming as in RxJava mainly for the pre-Java-8 world. The Stream API in Java 8 is not exactly the same thing because Streams can be only consumed once while

Iterable
s can be consumed many times. Google Guava features a lot of Iterable operators, plus now they have the
FluentIterable
with similar setup but far less operators available.

This branch starts from scratch by reimplementing

ix.Ix
and all of its operators based on the +5 year experience with reactive and interactive dataflows.

Releases

Javadoc: https://akarnokd.github.com/ixjava/javadoc/index.html

gradle

dependencies {
    implementation 'com.github.akarnokd:ixjava:1.0.0'
}

Maven search:

http://search.maven.org

Examples

The main (and only) entry point is the class

ix.Ix
which features a bunch of static factory methods:
List list = Arrays.asList(1, 2, 3, 4, 5);

Ix seq = Ix.from(list);

Now we can apply instance methods on the

seq
sequence, just like in RxJava. Not all operators are available though due to the synchronous-pull nature of IxJava.
seq
.map(v -> v + 1)
.filter(v -> v % 2 == 0)
.flatMap(v -> Ix.fromArray(v * 10, v * 100)))
.subscribe(System.out::println)
;

Since

Ix
implements
Iterable
, you can use the for-each loop to consume it:
for (Integer v : Ix.fromArray(5, 10).skip(1).concatWith(Ix.just(20))) {
    System.out.println("Value: " + v);
}

For further details on the possibilities, please study the javadoc of

Ix
.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.