Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pakoito/RxCurrying
Simple currying for FuncN and ActionN on RxJava [STABLE]
https://github.com/pakoito/RxCurrying
Last synced: 24 days ago
JSON representation
Simple currying for FuncN and ActionN on RxJava [STABLE]
- Host: GitHub
- URL: https://github.com/pakoito/RxCurrying
- Owner: pakoito
- License: other
- Created: 2016-02-14T23:24:16.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-22T00:08:15.000Z (over 7 years ago)
- Last Synced: 2024-11-16T00:02:59.328Z (26 days ago)
- Language: Java
- Homepage:
- Size: 63.5 KB
- Stars: 38
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-rxjava - RxCurrying - Simple currying for FuncN and ActionN on RxJava. (Utilities)
README
# RxCurrying
RxCurrying is a library to allow [currying](https://en.wikipedia.org/wiki/Currying) on RxJava function primitives.
For the RxJava 2.X version, please go to [RxCurrying2](https://github.com/pakoito/RxCurrying2).
## Usage
RxCurrying contains two classes, `RxCurryingAction` and `RxCurryingFunc`. Each contains a set of `curry()` methods to do split any function into its curried version. Curried methods allows calling them one parameter at a time, and execute them at the end. For example, a `Func3` becomes a `Func1>>`, or an `Action4` becomes `Func1>>`.
Function to print the sum of two numbers:
```java
Func1> adder = RxCurryingAction.curry((int first, int second) -> { System.out.print(first + second); });
Action1 intermediate = adder.call(3);
intermediate.call(2); // prints 5
```Append 5 strings:
```java
Func1>>>> appender = RxCurryingFunc.curry((String first, String second, String third, String fourth, String fifth) -> { return first + second + third + fourth + fifth; );
Func1 intermediate = appender.call("Hello ").call("This ").call("Is ").call("Curried ");
String value = last.call("Func"); // value == "Hello This is Curried Func"
```## Distribution
Add as a dependency to your `build.gradle`
```groovy
repositories {
...
maven { url "https://jitpack.io" }
...
}dependencies {
...
compile 'com.github.pakoito:RxCurrying:1.1.0'
...
}
```
or to your `pom.xml`
```xml
jitpack.io
https://jitpack.io
com.github.pakoito
RxCurrying
1.1.0```
## LicenseCopyright (c) pakoito 2016
The Apache Software License, Version 2.0
See LICENSE.md