Is Java 8 missing an OptionalBoolean?

前端 未结 4 1652
醉话见心
醉话见心 2020-12-29 20:23

As a primitive version of Optional*, Java 1.8 provides OptionalInt, OptionalLong and OptionalDouble.

But I cannot find the equivalent OptionalBoolean cl

4条回答
  •  Happy的楠姐
    2020-12-29 20:54

    Just to be complete about that: There is indeed an OptionalBoolean in Java 8, but not where you would expect it: it is com.sun.javafx.scene.control.behavior.OptionalBoolean.

    But, while JavaFX is nowadays a fixed component of Java, it is not advisable to use it outside of JavaFX stuff.

    Apart from that, its interface is completely different from the ones you have in java.util.*.

提交回复
热议问题