[JAVA-14461] Improvement/ making code more declarative (#12710)

Co-authored-by: panagiotiskakos <panagiotis.kakos@libra-is.com>
This commit is contained in:
panos-kakos 2022-09-11 07:29:03 +01:00 committed by GitHub
parent 8066e08c68
commit ac619f1f4b
1 changed files with 3 additions and 3 deletions

View File

@ -71,7 +71,7 @@ public class BiFunctionalInterfacesUnitTest {
List<String> list1 = Arrays.asList("a", "b", "c");
List<Integer> list2 = Arrays.asList(1, 2, 3);
List<String> result = listCombiner(list1, list2, (a, b) -> a + b);
List<String> result = listCombiner(list1, list2, (letter, number) -> letter + number);
assertThat(result).containsExactly("a1", "b2", "c3");
}
@ -92,7 +92,7 @@ public class BiFunctionalInterfacesUnitTest {
List<Float> list2 = Arrays.asList(0.1f, 0.2f, 4f);
// algorithm to determine if the value in list1 > value in list 2
List<Boolean> result = listCombiner(list1, list2, (a, b) -> a > b);
List<Boolean> result = listCombiner(list1, list2, (doubleNumber, floatNumber) -> doubleNumber > floatNumber);
assertThat(result).containsExactly(true, true, false);
}
@ -117,7 +117,7 @@ public class BiFunctionalInterfacesUnitTest {
List<Float> list1 = Arrays.asList(0.1f, 0.2f, 4f);
List<Float> list2 = Arrays.asList(0.1f, 0.2f, 4f);
List<Boolean> result = listCombiner(list1, list2, (a, b) -> a.equals(b));
List<Boolean> result = listCombiner(list1, list2, (float1, float2) -> float1.equals(float2));
assertThat(result).containsExactly(true, true, true);
}