Code Monkey home page Code Monkey logo

ixjava's Introduction

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 Iterables 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

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<Integer> list = Arrays.asList(1, 2, 3, 4, 5);

Ix<Integer> 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.

ixjava's People

Contributors

akarnokd avatar bryant1410 avatar nfekete avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ixjava's Issues

[Security] Workflow gradle-wrapper-validation.yml is using vulnerable action gradle/wrapper-validation-action

The workflow gradle-wrapper-validation.yml is referencing action gradle/wrapper-validation-action using references v1. However this reference is missing the commit 89eda1fdc0167f59521d2bb10767f7169fb4d018 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.

Split a Collection into 2 lists and subscribe both?

My use case is as follow:

  • A collection of Box as source: boxes.

  • There are red boxes and blue boxes in source.

  • Once I "press the button" (start the stream), it will split the boxes into 2 lists by box's color, and I could subscribe to the value contain both of them.

My imagine is as follow (seudo):

Ix.from(source)
.split((predicate) -> predicate.apply(box) /* return true if box is red, false otherwise*/)
.subscribe((redBoxes, blueBoxes) -> { /* do something, maybe share them with friends */})

How can I archive this behaviour with your current implementation? If it is not possible now, any opinion on why and how?

P/S: I know about the "except" operator. But it ends up creating extra Collection which I want to avoid.

Thanks.

Sync operators with RxJava/Rsc

IxJava is a bit behind some operators. This issue will collect these into a checklist:

  • concatMap
  • subscribe(Action1) - alternative to forEach due to name conflict in Java 8
  • subscribe(Observer) - to feed a regular Observer with the same naming pattern

What?

Hello @akarnokd ,

I don't grok it (immediately)... what about a small code example on "page 1" (README.md)

Thanks and best regards from Switzerland,
Peti

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.