question: public static boolean nanSafeEqualsDoubles ( Double d1 , Double d2 ) { Boolean xIsNan = Double . isNaN ( d1 ) ; Boolean yIsNan = Double . isNaN ( d2 ) ; if ( ( xIsNan && yIsNan ) || ( d1 . doubleValue ( ) == d2 . doubleValue ( ) ) ) { return true ; } return false ; }
target:  This method will compare double values for its equality and also it will preserve the -0.0 and 0.0 equality as per == ,also preserve NaN equality check as per java.lang.Double.equals()