Java.util.function.Function: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=External= * https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html =Internal= * Java 8 Lambda Expressions =Over...")
 
 
(9 intermediate revisions by the same user not shown)
Line 8: Line 8:


=Overview=
=Overview=
<syntaxhighlight lang='java'>
@FunctionalInterface
public interface Function<I, O> {
    O apply(I input);
    ....
}
</syntaxhighlight>
=Primitive Type Functions=
* <code>[https://docs.oracle.com/javase/8/docs/api/java/util/function/IntFunction.html IntFunction<T>]</code> a function that receives an <tt>int</tt> argument and returns an argument of type T.
* <code>[https://docs.oracle.com/javase/8/docs/api/java/util/function/ToIntFunction.html ToIntFunction<T>]</code> a function that receives an argument of type T and returns an <tt>int</tt>.


=Composition Methods=
=Composition Methods=
* <code>[https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html#andThen-java.util.function.Function- andThen(Function)]</code>
* <code>[https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html#compose-java.util.function.Function- compose(Function)]</code>

Latest revision as of 19:03, 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