Java.util.function.Function: Difference between revisions
Jump to navigation
Jump to search
(7 intermediate revisions by the same user not shown) | |||
Line 11: | Line 11: | ||
<syntaxhighlight lang='java'> | <syntaxhighlight lang='java'> | ||
@FunctionalInterface | @FunctionalInterface | ||
public interface Function< | public interface Function<I, O> { | ||
O apply(I input); | |||
.... | .... | ||
} | } | ||
</syntaxhighlight> | </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.