RxJava-Optional

General

Category
Free
Tag
FRP
License
Apache License, Version 2.0
Registered
Feb 6, 2015
Favorites
0
Link
https://github.com/eccyan/RxJava-Optional
See also
Intro to RxJava
RxT4A
rxjava-extras
RxActions
ixjava

Additional

Language
Java
Version
1.1.0 (Feb 10, 2015)
Created
Feb 5, 2015
Updated
Dec 12, 2015 (Retired)
Owner
eccyan
Contributor
eccyan
1
Activity
Badge
Generate
Download
Source code

Advertising

RxJava-Optional

RxJava-Optional is an library that allows developers to use Optional using RxJava

Install

Download the latest JAR or grab via Gradle:

Gradle

repositories {
    jcenter()
}

dependencies {
    compile 'io.reactivex:rxandroid:0.24.0'
    //  compile 'io.reactivex:rxjava:1.0.5'
    compile 'com.eccyan:rxjava-optional:1.1.0'
}

How to use

Optional<String> lastName = Optional.ofNullable("Daisuke");
Optional<String> firstName = Optional.ofNullable("Sato");
Optional<String> fullname =
        lastName.flatMap(new Func1<String, Optional<String>>() {
            @Override
            public Optional<String> call(final String ln) {
                return firstName.map(new Func1<String, String>() {
                    @Override
                    public String call(final String fn) {
                        return Strings.join(" ", ln, fn);
                    }
                });
            }
        });

// With retrolambda
fullName = lastName.flatMap(ln -> firstName.map(fn -> Strings.join(" ", ln, fn)));

Developed By

Daisuke Sato(eccyan) - g00.eccyan@gmail.com

Thanks

License

Copyright 2015 eccyan

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.