Returns whether all of the elements of a list are equal. The list is assumed to be non-empty.
(List<E> list)
| 2369 | /** Returns whether all of the elements of a list are equal. |
| 2370 | * The list is assumed to be non-empty. */ |
| 2371 | private static <E> boolean allSameElement(List<E> list) { |
| 2372 | final Iterator<E> iterator = list.iterator(); |
| 2373 | final E first = iterator.next(); |
| 2374 | while (iterator.hasNext()) { |
| 2375 | if (!Objects.equals(first, iterator.next())) { |
| 2376 | return false; |
| 2377 | } |
| 2378 | } |
| 2379 | return true; |
| 2380 | } |
| 2381 | |
| 2382 | /** Converts an iterable into a list with unique elements. |
| 2383 | * |
no test coverage detected