public class Scala
extends java.lang.Object
Constructor and Description |
---|
Scala() |
Modifier and Type | Method and Description |
---|---|
static <T> T[] |
asArray(java.lang.Class<T> clazz,
scala.collection.Seq<T> scalaList)
Converts a Scala List to an Array.
|
static <K,V> java.util.Map<K,V> |
asJava(scala.collection.Map<K,V> scalaMap)
Converts a Scala Map to Java.
|
static <T> java.util.List<T> |
asJava(scala.collection.Seq<T> scalaList)
Converts a Scala List to Java.
|
static <A,B> F.Tuple<A,B> |
asJava(scala.Tuple2<A,B> tuple)
Convert a scala Tuple2 to a java F.Tuple.
|
static <A> scala.Function0<A> |
asScala(java.util.concurrent.Callable<A> callable)
Converts a Java Callable to a Scala Function0.
|
static <A> scala.collection.immutable.Seq<A> |
asScala(java.util.Collection<A> javaCollection)
Converts a Java Collection to a Scala Seq.
|
static <A,B> scala.collection.immutable.Map<A,B> |
asScala(java.util.Map<A,B> javaMap)
Converts a Java Map to Scala.
|
static <C> scala.reflect.ClassTag<C> |
classTag()
Returns an any ClassTag typed according to the Java compiler as C.
|
static <A,B> scala.collection.immutable.Map<A,B> |
emptyMap()
Creates an empty Scala Map.
|
static <T> scala.collection.Seq<T> |
emptySeq()
Creates an empty Scala Seq.
|
static java.lang.RuntimeException |
noMatch()
Throw this exception to indicate that a partial function doesn't match.
|
static <T> scala.Option<T> |
None()
None
|
static <T> scala.Option<T> |
Option(T t)
Wrap a value into a Scala Option.
|
static <T> T |
orElse(scala.Option<T> opt,
T defaultValue)
Wrap a Scala Option, handling None by returning a defaultValue
|
static <T> T |
orNull(scala.Option<T> opt)
Wrap a Scala Option, handling None as null.
|
static <A,B> scala.PartialFunction<A,B> |
partialFunction(java.util.function.Function<A,B> f)
Create a Scala PartialFunction from a function.
|
static <T> scala.collection.Seq<T> |
toSeq(java.util.List<T> list)
Converts a Java List to Scala Seq.
|
static <T> scala.collection.Seq<T> |
toSeq(T[] array)
Converts a Java Array to Scala Seq.
|
static <A,B> scala.Tuple2<A,B> |
Tuple(A a,
B b)
Create a Scala Tuple2.
|
static <T> scala.collection.Seq<T> |
varargs(T... array)
Converts a Java varargs to Scala Seq.
|
public static <T> T orNull(scala.Option<T> opt)
public static <T> T orElse(scala.Option<T> opt, T defaultValue)
public static <K,V> java.util.Map<K,V> asJava(scala.collection.Map<K,V> scalaMap)
public static <A,B> scala.collection.immutable.Map<A,B> asScala(java.util.Map<A,B> javaMap)
public static <A> scala.collection.immutable.Seq<A> asScala(java.util.Collection<A> javaCollection)
public static <A> scala.Function0<A> asScala(java.util.concurrent.Callable<A> callable)
public static <T> java.util.List<T> asJava(scala.collection.Seq<T> scalaList)
public static <T> T[] asArray(java.lang.Class<T> clazz, scala.collection.Seq<T> scalaList)
public static <T> scala.collection.Seq<T> toSeq(java.util.List<T> list)
public static <T> scala.collection.Seq<T> toSeq(T[] array)
public static <T> scala.collection.Seq<T> varargs(T... array)
public static <T> scala.Option<T> Option(T t)
public static <T> scala.Option<T> None()
public static <A,B> scala.Tuple2<A,B> Tuple(A a, B b)
public static <A,B> F.Tuple<A,B> asJava(scala.Tuple2<A,B> tuple)
public static <T> scala.collection.Seq<T> emptySeq()
public static <A,B> scala.collection.immutable.Map<A,B> emptyMap()
public static <C> scala.reflect.ClassTag<C> classTag()
public static <A,B> scala.PartialFunction<A,B> partialFunction(java.util.function.Function<A,B> f)
F.noMatch()
, and this will be translated into the semantics
of a Scala PartialFunction.
For example:
Flow<String, Integer, ?> collectInts = Flow.<String>collect(Scala.partialFunction( str -> { try { return Integer.parseInt(str); } catch (NumberFormatException e) { throw Scala.noMatch(); } }));The above code will convert a flow of String into a flow of Integer, dropping any strings that can't be parsed as integers.
f
- The function to make a partial function from.public static java.lang.RuntimeException noMatch()