@Test void givenValuesAreNotEqualItShouldReturnFalse() { FloatComparisonStep<TestData> hashStep = new FloatComparisonStep<>(TestData::getValue); boolean result = hashStep.isEqual(new TestData(1234.0f), new TestData(1337.0f)); assertThat(result) .isFalse(); }
@Override public boolean isEqual(T object1, T object2) { float value1 = valueExtractor.applyAsFloat(object1); float value2 = valueExtractor.applyAsFloat(object2); return floatToIntBits(value1) == floatToIntBits(value2); }
FloatComparisonStep implements ComparisonStep<T> { @Override public boolean isEqual(T object1, T object2) { float value1 = valueExtractor.applyAsFloat(object1); float value2 = valueExtractor.applyAsFloat(object2); return floatToIntBits(value1) == floatToIntBits(value2); } }
FloatComparisonStep implements ComparisonStep<T> { @Override public boolean isEqual(T object1, T object2) { float value1 = valueExtractor.applyAsFloat(object1); float value2 = valueExtractor.applyAsFloat(object2); return floatToIntBits(value1) == floatToIntBits(value2); } FloatComparisonStep(ToFloatFunction<? super T> valueExtractor); }
FloatComparisonStep implements ComparisonStep<T> { @Override public boolean isEqual(T object1, T object2) { float value1 = valueExtractor.applyAsFloat(object1); float value2 = valueExtractor.applyAsFloat(object2); return floatToIntBits(value1) == floatToIntBits(value2); } FloatComparisonStep(ToFloatFunction<? super T> valueExtractor); @Override boolean isEqual(T object1, T object2); }
FloatComparisonStep implements ComparisonStep<T> { @Override public boolean isEqual(T object1, T object2) { float value1 = valueExtractor.applyAsFloat(object1); float value2 = valueExtractor.applyAsFloat(object2); return floatToIntBits(value1) == floatToIntBits(value2); } FloatComparisonStep(ToFloatFunction<? super T> valueExtractor); @Override boolean isEqual(T object1, T object2);  }