Java.util.function.Function: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 11: Line 11:
<syntaxhighlight lang='java'>
<syntaxhighlight lang='java'>
@FunctionalInterface
@FunctionalInterface
public interface Function<T, R> {
public interface Function<I, O> {


     R apply(T t);
     O apply(I input);


     ....
     ....

Revision as of 18:28, 1 September 2021

External

Internal

Overview

@FunctionalInterface
public interface Function<I, O> {

    O apply(I input);

    ....
}

Primitive Type Functions

  • IntFunction<T> a function that receives an int argument and returns an argument of type T.
  • ToIntFunction<T> a function that receives an argument of type T and returns an int.

Composition Methods