java check if all values of array are the same 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