cyclops.conversion.vavr.FromJDK Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cyclops-vavr Show documentation
Show all versions of cyclops-vavr Show documentation
Converters and Comprehenders for Javaslang
The newest version!
package cyclops.conversion.vavr;
import java.util.function.BiFunction;
import java.util.function.Function;
import io.vavr.Function1;
import io.vavr.Function2;
import io.vavr.collection.Stream;
import io.vavr.control.Option;
public class FromJDK {
public static Function1 f1(Function fn) {
return (t) -> fn.apply(t);
}
public static Function2 f2(BiFunction fn) {
return (t, x) -> fn.apply(t, x);
}
public static Option option(java.util.Optional o) {
return Option.of(o.orElse(null));
}
public static Stream stream(java.util.stream.Stream stream) {
return Stream.ofAll(() -> stream.iterator());
}
}