All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aol.cyclops.functionaljava.FromCyclopsReact Maven / Gradle / Ivy

There is a newer version: 9.0.0-MI7
Show newest version
package com.aol.cyclops.functionaljava;

import com.aol.cyclops.control.Xor;
import com.aol.cyclops.types.MonadicValue;

import fj.data.Either;
import fj.data.Option;
import fj.data.Validation;

public class FromCyclopsReact {
    public static  fj.data.Stream stream(java.util.stream.Stream s) {
        
        return fj.data.Stream.iteratorStream(s.iterator());
    }
   
    public static  Option option(MonadicValue value) {
        return Option.fromNull(value.orElse(null));
    }

    public static  Either either(Xor value) {
        Xor xor = (Xor) value.toXor();
        return xor.visit(l -> Either.left(l), r -> Either.right(r));
    }

    public static  Validation validation(Xor value) {
        return Validation.validation(either(value));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy