Taking on the hard way to discover equals() – Objects, Immutability, Switch Expressions, and Pattern Matching

50. Taking on the hard way to discover equals() Check out the following code: Integer x1 = 14; Integer y1 = 14;Integer x2 = 129; Integer y2 = 129;List<Integer> listOfInt1 = new ArrayList<>( Arrays.asList(x1, y1, x2, y2));listOfInt1.removeIf(t -> t == x1 || t == x2);List<Integer> listOfInt2 = new ArrayList<>(  Arrays.asList(x1, y1, x2, y2));listOfInt2.removeIf(t -> t.equals(x1) || […]

© 2024 nickshade Please read our Terms and Privacy Policy. We also use Cookies.