小编fab*_*tch的帖子

Java Double.valueOf

在我的工作中,所有开发人员都使用Double.valueOf而不是new Double构造函数。在每种情况下。对于 Integer 或 Short 我可以理解它的缓存值但不是 fordoublefloat

在 OpenJDK 源代码中查看 Double.valueOf :

 /**
 * Returns a {@code Double} instance representing the specified
 * {@code double} value.
 * If a new {@code Double} instance is not required, this method
 * should generally be used in preference to the constructor
 * {@link #Double(double)}, as this method is likely to yield
 * significantly better space and time performance by caching
 * frequently requested …
Run Code Online (Sandbox Code Playgroud)

java jvm

14
推荐指数
2
解决办法
306
查看次数

标签 统计

java ×1

jvm ×1