为什么叫BiConsumer?

接受两个参数的Consumer为什么叫BiConsumer?

这里的 i 是指 input吗? 那B又是指什么?这里BiConsumer是怎样命名的?

/**

* Represents an operation that accepts two input arguments and returns no

* result. This is the two-arity specialization of {@link Consumer}.

* Unlike most other functional interfaces, {@code BiConsumer} is expected

* to operate via side-effects.

*

* <p>This is a <a href="package-summary.html">functional interface</a>

* whose functional method is {@link #accept(Object, Object)}.

*

* @param <T> the type of the first argument to the operation

* @param <U> the type of the second argument to the operation

*

* @see Consumer

* @since 1.8

*/

@FunctionalInterface

public interface BiConsumer<T, U> {

/**

* Performs this operation on the given arguments.

*

* @param t the first input argument

* @param u the second input argument

*/

void accept(T t, U u);

}


回答:

Binary 的缩写,在这里的意思是‘和两件事有关’

以上是 为什么叫BiConsumer? 的全部内容, 来源链接: utcz.com/p/945300.html

回到顶部