Java, Eclipse Collections, Open Source, Programming, Software Development.
convertToMapForEquality() { List<Fruit> list = List.of(Fruit.BANANA, Fruit.BANANA, Fruit.APPLE, Fruit.CHERRY); // Converting to Map we can also test size and contents without order Map<Fruit, Long> simulatedBag = list.stream() .collect(Collectors.groupingBy(each -> each, Collectors.counting()));