com.aol.cyclops.javaslang.FromTotallyLazy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cyclops-javaslang Show documentation
Show all versions of cyclops-javaslang Show documentation
Converters and Comprehenders for Javaslang
package com.aol.cyclops.javaslang;
import javaslang.Function1;
import javaslang.Function2;
import javaslang.Tuple2;
import javaslang.Tuple3;
import javaslang.Tuple4;
import javaslang.Tuple5;
import javaslang.control.Either;
import javaslang.control.Left;
import javaslang.control.Option;
import javaslang.control.Right;
/**
import com.googlecode.totallylazy.Pair;
import com.googlecode.totallylazy.Quadruple;
import com.googlecode.totallylazy.Quintuple;
import com.googlecode.totallylazy.Triple;
**/
public class FromTotallyLazy {
/**
public static Function1 λ(com.googlecode.totallylazy.Function fn){
return (t) -> fn.apply(t);
}
public static Function2 λ2(com.googlecode.totallylazy.Function2 fn){
return (t,x) -> fn.apply(t,x);
}
public static Option option(com.googlecode.totallylazy.Option o){
return Option.of(o.getOrNull());
}
public static Either either(com.googlecode.totallylazy.Either e){
if(e.isLeft())
return new Left(e.value());
else
return new Right(e.value());
}
public static Tuple2 tuple(Pair t){
return new Tuple2(t._1(),t._2());
}
public static Tuple3 tuple(Triple t){
return new Tuple3(t.first(),t.second(),t.third());
}
public static Tuple4 tuple(Quadruple t){
return new Tuple4(t.first(),t.second(),t.third(),t.fourth());
}
public static Tuple5 tuple(Quintuple t){
return new Tuple5(t.first(),t.second(),t.third(),t.fourth(),t.fifth());
}
**/
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy