check if list contains same elements 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