[英]Effective Java Item 44 - Where is the `DoubleToObjFunction` in the standard library?
在 Effective Java 第 44 條中,作者建議使用標准功能接口(而不是定義自定義接口)。 關於java.util.function
package,作者:
列出了六個基本 forms: UnaryOperator<T>
, BinaryOperator<T>
, Predicate<T>
, Function<T, R>
, Supplier<T>
, Consumer<T>
;
解釋了對基本類型進行操作的六個基本 forms 中的每一個都有三個變體,例如IntPredicate
、 LongBinaryOperator
和LongFunction<int[]>
;
在下一段中提到了以下內容:
Function
接口的另外九個變體...如果源是原語並且結果是 object 引用,前綴 Function 和SrcToObj
(三個變體,例如DoubleToObjFunction
)。
作者提到的這個DoubleToObjFunction
在哪里?
請注意,在上面的第三個要點中,他使用了“九個附加變體”一詞,因此不可能指的是DoubleFunction
,因為這將在第二個要點中涵蓋。
I have tried a basic Google search of the function name in quotation, and also looked at the latest Java documentation on java.util.function but couldn't seem to find anything.
Java 8中沒有DoubleToObjFunction、LongToObjFunction和IntToObjFunction接口,但作者在第44條中沒有提到ToDoubleFunction、ToLongFunction和ToIntFunction接口,可能是勘誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.