Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akarnokd/ixjava
Iterable Extensions for Java 6+
https://github.com/akarnokd/ixjava
iterable iterable-extensions java rxjava stream
Last synced: 5 days ago
JSON representation
Iterable Extensions for Java 6+
- Host: GitHub
- URL: https://github.com/akarnokd/ixjava
- Owner: akarnokd
- License: apache-2.0
- Created: 2014-01-13T10:36:31.000Z (almost 11 years ago)
- Default Branch: 1.x
- Last Pushed: 2022-01-05T15:31:01.000Z (almost 3 years ago)
- Last Synced: 2024-10-26T21:32:43.732Z (19 days ago)
- Topics: iterable, iterable-extensions, java, rxjava, stream
- Language: Java
- Homepage:
- Size: 701 KB
- Stars: 208
- Watchers: 12
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
ixjava
=================
[![codecov.io](http://codecov.io/github/akarnokd/ixjava/coverage.svg?branch=1.x)](http://codecov.io/github/akarnokd/ixjava?branch=1.x)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.akarnokd/ixjava/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.akarnokd/ixjava)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.io/ixjava/javadoc/index.html
**gradle**
```groovy
dependencies {
implementation 'com.github.akarnokd:ixjava:1.0.0'
}
```Maven search:
[http://search.maven.org](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.github.akarnokd%22)
# Examples
The main (and only) entry point is the class `ix.Ix` which features a bunch of static factory methods:
```java
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.
```java
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:
```java
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`.