Listnumbers = Arrays.asList(1, 2, 3, 4, 5);
SetHere, we are using the assertEquals() method to compare the expectedSet to the numberSet. If the sets do not contain the same elements in the same order, the test will fail. Overall, the Collectors class is part of the java.util.stream package library, which provides a powerful suite of tools for manipulating streams of data in Java.numberSet = numbers.stream() .collect(Collectors.toSet()); Set expectedSet = new HashSet<>(); expectedSet.add(1); expectedSet.add(2); expectedSet.add(3); expectedSet.add(4); expectedSet.add(5); assertEquals(expectedSet, numberSet);