Re: [13] RFR 8215913: [Test_bug]java/util/Locale/LocaleProvidersRun.java failed on de_DE and ja_JP locale.

2019-01-06 Thread Dora Zhou
Hi Rachna, Updated the webrev: http://cr.openjdk.java.net/~dzhou/8215913/webrev.01/ Regards, Dora On 2019/1/4 17:44, Rachna Goel wrote: Hi Dora, Kindly update copyright years in both files and add bug id in LocaleProvidersRun.java. Other than that, it looks good to me. Thanks, Rachna

Re: Feature suggestion: Add static equals methods to Float and Double

2019-01-06 Thread Zheka Kozlov
Objects.equals is not type-safe: Objects.equals(1, "your mom"); // returns false Comparator.equal(1, "your mom"); // error However, I agree that they are both slower than Float.equal(float, float) and Double.equal(double, double). пн, 7 янв. 2019 г. в 01:41, <

Re: Feature suggestion: Add static equals methods to Float and Double

2019-01-06 Thread Brian Goetz
Followers of Project Valhalla will see that this issue comes up when defining equality on value types.  The relation you are looking for is being called "substitutible"; it asks whether there is any way to distinguish between two values.  For primitives other than float/double, this coincides

Re: Feature suggestion: Provide efficient way for nullable value lookup in Map

2019-01-06 Thread Brian Goetz
FYI, the comment about compatibility was obsoleted by the addition of default methods in Java 8. On 1/4/2019 6:34 PM, some-java-user-99206970363698485...@vodafonemail.de wrote: The methods currently provided by the Map interface (https://docs.oracle.com/javase/8/docs/api/java/util/Map.html)

Re: Feature suggestion: Add static equals methods to Float and Double

2019-01-06 Thread some-java-user-99206970363698485155
My main goal was to provide a way where NaN is equal to NaN and I went with the behavior of the respective wrapper classes, Float and Double, which consider -0.0 and +0.0 as not equal. The static method could be called "exactlyEquals" if that is better. It might also depend on the usecase

Re: Feature suggestion: Add static equals methods to Float and Double

2019-01-06 Thread some-java-user-99206970363698485155
If the developer implemented the Comparable interface correctly, the method you proposed would be equivalent to java.util.Objects.equals(Object, Object). Additionally both variants would require boxing for primitive types which I initially wanted to prevent. > Zheka Kozlov hat am 6. Januar

Re: Feature suggestion: Add static equals methods to Float and Double

2019-01-06 Thread Zheka Kozlov
Why don't we just add a generic method which compares any instances of Comparable? public interface Comparator { ... public static > boolean equal(T x, T y) { return x.compareTo(y) == 0; } } Usage: Comparator.equal(1, 1); // true Comparator.equal(1.0, 1.0); // true