Why does the Double.valueof javadoc say it caches values, when it doesn't?

前端 未结 6 1612
小鲜肉
小鲜肉 2020-12-15 02:30

In OpenJDK, for the method:

public static Double valueOf(double d)

The javadoc says:

Returns a Double instance repre

6条回答
  •  青春惊慌失措
    2020-12-15 03:16

    The designers of the API probably didn’t want to restrict alternate implementation. Those are now free to add caching to the Double class.

提交回复
热议问题