BiFunction
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
BinaryOperator<T> |
Represents an operation upon two operands of the same type, producing a result
of the same type as the operands. |
|
Public Method Summary
<V>
BiFunction<T, U, V>
|
andThen( Function<? super R, ? extends V> after)
Returns a composed function that first applies this function to
its input, and then applies the after function to the result.
|
abstract
R
|
apply(T t, U u)
Applies this function to the given arguments.
|
Public Methods
public
BiFunction<T, U, V>
andThen
(Function<? super R, ? extends V> after)
Returns a composed function that first applies this function to
its input, and then applies the after
function to the result.
If evaluation of either function throws an exception, it is relayed to
the caller of the composed function.
Parameters
after |
the function to apply after this function is applied |
Returns
- a composed function that first applies this function and then
applies the
after
function
public
abstract
R
apply
(T t, U u)
Applies this function to the given arguments.
Parameters
t |
the first function argument |
u |
the second function argument |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eBiFunction\u003c/code\u003e represents a function that accepts two arguments and produces a result.\u003c/p\u003e\n"],["\u003cp\u003eIt is a functional interface with a primary method \u003ccode\u003eapply(Object, Object)\u003c/code\u003e that executes the function's logic.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eandThen\u003c/code\u003e method allows chaining another function to be applied to the result of the initial \u003ccode\u003eBiFunction\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBiFunction\u003c/code\u003e is a specialization of the \u003ccode\u003eFunction\u003c/code\u003e interface, specifically designed for two-argument functions.\u003c/p\u003e\n"]]],["`BiFunction` is a functional interface representing a function that accepts two arguments and produces a result. It's a two-arity specialization of `Function`. The core method is `apply(T t, U u)`, which applies the function to given arguments, returning the result. The `andThen` method allows composing functions, applying the `BiFunction` first and then another provided function to its result, returning the new composed function. `BinaryOperator` is a known indirect subclass of `BiFunction`.\n"],null,["# BiFunction\n\npublic interface **BiFunction** \n\n|---|---|---|\n| Known Indirect Subclasses [BinaryOperator](../../../../reference/java/util/function/BinaryOperator.html)\\\u003cT\\\u003e |-------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------| | [BinaryOperator](../../../../reference/java/util/function/BinaryOperator.html)\\\u003cT\\\u003e | Represents an operation upon two operands of the same type, producing a result of the same type as the operands. | |||\n\nRepresents a function that accepts two arguments and produces a result.\nThis is the two-arity specialization of [Function](../../../../reference/java/util/function/Function.html).\n\nThis is a [functional interface](/j2objc/javadoc/jre/reference/java/util/function/package-summary)\nwhose functional method is [apply(Object, Object)](../../../../reference/java/util/function/BiFunction.html#apply(T,%20U)). \n\n##### See Also\n\n- [Function](../../../../reference/java/util/function/Function.html) \n\n### Public Method Summary\n\n|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| \\\u003cV\\\u003e [BiFunction](../../../../reference/java/util/function/BiFunction.html)\\\u003cT, U, V\\\u003e | [andThen](../../../../reference/java/util/function/BiFunction.html#andThen(java.util.function.Function\u003c?%20super%20R,%20?%20extends%20V\u003e))([Function](../../../../reference/java/util/function/Function.html)\\\u003c? super R, ? extends V\\\u003e after) Returns a composed function that first applies this function to its input, and then applies the `after` function to the result. |\n| abstract R | [apply](../../../../reference/java/util/function/BiFunction.html#apply(T,%20U))(T t, U u) Applies this function to the given arguments. |\n\nPublic Methods\n--------------\n\n#### public [BiFunction](../../../../reference/java/util/function/BiFunction.html)\\\u003cT, U, V\\\u003e\n**andThen**\n([Function](../../../../reference/java/util/function/Function.html)\\\u003c? super R, ? extends V\\\u003e after)\n\nReturns a composed function that first applies this function to\nits input, and then applies the `after` function to the result.\nIf evaluation of either function throws an exception, it is relayed to\nthe caller of the composed function. \n\n##### Parameters\n\n| after | the function to apply after this function is applied |\n|-------|------------------------------------------------------|\n\n##### Returns\n\n- a composed function that first applies this function and then applies the `after` function \n\n##### Throws\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if after is null |\n|-----------------------------------------------------------------------------------|------------------|\n\n#### public abstract R\n**apply**\n(T t, U u)\n\nApplies this function to the given arguments. \n\n##### Parameters\n\n| t | the first function argument |\n| u | the second function argument |\n|---|------------------------------|\n\n##### Returns\n\n- the function result"]]