Object/Class

com.twitter.util

Function

Related Docs: class Function | package util

Permalink

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. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def cons[T](f: JavaConsumer[T]): Function[T, Unit]

    Permalink

    Creates a Function of T to Unit from a JavaConsumer.

    Creates a Function of T to Unit from a 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

    func0 if you have a function which takes no input.

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

    excons if your function throws checked exceptions.

  7. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  9. def excons[T](f: ExceptionalJavaConsumer[T]): ExceptionalFunction[T, Unit]

    Permalink

    Creates an ExceptionalFunction of T to Unit from an ExceptionalJavaConsumer.

    Creates an ExceptionalFunction of T to Unit from an 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]

    Permalink

    Creates an ExceptionalFunction of T to R from an ExceptionalJavaFunction.

    Creates an ExceptionalFunction of T to R from an 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]

    Permalink

    Creates an ExceptionalFunction0 to T from an ExceptionalSupplier.

    Creates an ExceptionalFunction0 to T from an 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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. def func[T, R](f: JavaFunction[T, R]): Function[T, R]

    Permalink

    Creates a Function of T to R from a JavaFunction.

    Creates a Function of T to R from a 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

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

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

    func0 if you have a function which takes no input.

    exfunc if your function throws checked exceptions.

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

    Permalink

    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

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

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

  15. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  17. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  18. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. def ofCallable[A](c: Callable[A]): () ⇒ A

    Permalink

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

  22. def ofRunnable(r: Runnable): () ⇒ Unit

    Permalink

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

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

    Permalink

    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

    Permalink
    Definition Classes
    AnyRef
  25. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  28. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped