how to check if all items in a list are equal java code example
Example: check if all values are same in list java
boolean allEqual = list.stream().distinct().limit(2).count() <= 1
boolean allEqual = list.stream().distinct().limit(2).count() <= 1