Packages

object Function

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Function
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. def cons[T](f: JavaConsumer[T]): Function[T, Unit]

    Creates a Function of T to Unit from a com.twitter.function.JavaConsumer.

    Creates a Function of T to Unit from a com.twitter.function.JavaConsumer.

    Allows for better interop with Scala from Java 8 using lambdas.

    For example:

    import com.twitter.util.Future;
    import static com.twitter.util.Function.cons;
    
    Future<String> fs = Future.value("example");
    Future<String> f2 = fs.onSuccess(cons(s -> System.out.println(s)));
    // or using method references:
    fs.onSuccess(cons(System.out::println));
    See also

    excons if your function throws checked exceptions.

    func if you have a function which returns a type, R.

    func0 if you have a function which takes no input.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  9. def excons[T](f: ExceptionalJavaConsumer[T]): ExceptionalFunction[T, Unit]

    Creates an ExceptionalFunction of T to Unit from an com.twitter.function.ExceptionalJavaConsumer.

    Creates an ExceptionalFunction of T to Unit from an com.twitter.function.ExceptionalJavaConsumer.

    Allows for better interop with Scala from Java 8 using lambdas.

    For example:

    import com.twitter.util.Future;
    import static com.twitter.util.Function.excons;
    
    Future<String> fs = Future.value("example");
    Future<String> f2 = fs.onSuccess(excons(s -> { throw new Exception(s); }));
  10. def exfunc[T, R](f: ExceptionalJavaFunction[T, R]): ExceptionalFunction[T, R]

    Creates an ExceptionalFunction of T to R from an com.twitter.function.ExceptionalJavaFunction.

    Creates an ExceptionalFunction of T to R from an com.twitter.function.ExceptionalJavaFunction.

    Allows for better interop with Scala from Java 8 using lambdas.

    For example:

    import com.twitter.util.Future;
    import static com.twitter.util.Function.exfunc;
    
    Future<String> fs = Future.value("example");
    Future<Integer> fi = fs.map(exfunc(s -> { throw new Exception(s); }));
  11. def exfunc0[T](f: ExceptionalSupplier[T]): ExceptionalFunction0[T]

    Creates an ExceptionalFunction0 to T from an com.twitter.function.ExceptionalSupplier.

    Creates an ExceptionalFunction0 to T from an com.twitter.function.ExceptionalSupplier.

    Allows for better interop with Scala from Java 8 using lambdas.

    For example:

    import com.twitter.util.Future;
    import static com.twitter.util.Function.exRunnable;
    
    FuturePool futurePool = FuturePools.immediatePool();
    Future<Unit> fu = futurePool.apply(exfunc0(() -> { throw new Exception("blah"); }));
  12. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  13. def func[T, R](f: JavaFunction[T, R]): Function[T, R]

    Creates a Function of T to R from a com.twitter.function.JavaFunction.

    Creates a Function of T to R from a com.twitter.function.JavaFunction.

    Allows for better interop with Scala from Java 8 using lambdas.

    For example:

    import com.twitter.util.Future;
    import static com.twitter.util.Function.func;
    
    Future<String> fs = Future.value("example");
    Future<Integer> fi = fs.map(func(s -> s.length()));
    // or using method references:
    Future<Integer> fi2 = fs.map(func(String::length));
    See also

    exfunc if your function throws checked exceptions.

    func0 if you have a function which takes no input.

    exfunc0 if your function throws checked exceptions and takes no input.

    cons if you have a side-effecting function (return type is Unit or void)

  14. def func0[T](f: Supplier[T]): Function0[T]

    Creates a Function0 of type-T from a java.util.function.JavaSupplier.

    Creates a Function0 of type-T from a java.util.function.JavaSupplier.

    Allows for better interop with Scala from Java 8 using lambdas.

    For example:

    import com.twitter.util.Future;
    import static com.twitter.util.Function.func0;
    
    Future<String> fs = Future.apply(func0(() -> "example"));
    Note

    as this was introduced after util dropped support for versions of Java below 8, there was no need for a JavaSupplier like class.

    See also

    func if you have a function which returns a type, R.

    cons if you have a side-effecting function (return type is Unit or void).

  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  19. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  20. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  21. def ofCallable[A](c: Callable[A]): () => A

    Creates () => A function (scala.Function0) from given Callable.

  22. def ofRunnable(r: Runnable): () => Unit

    Creates () => Unit function (scala.Function0) from given Runnable.

  23. def synchronizeWith[T, R](m: AnyRef)(f: (T) => R): (T) => R

    Compose a function with a monitor; all invocations of the returned function are synchronized with the given monitor m.

  24. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  27. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  28. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped