Returns true if every element in values is plain #contains contained in this range.
(Iterable<? extends C> values)
| 485 | |
| 486 | |
| 487 | public boolean containsAll(Iterable<? extends C> values) { |
| 488 | if (Iterables.isEmpty(values)) { |
| 489 | return true; |
| 490 | } |
| 491 | |
| 492 | // this optimizes testing equality of two range-backed sets |
| 493 | if (values instanceof SortedSet) { |
| 494 | SortedSet<? extends C> set = cast(values); |
| 495 | Comparator<?> comparator = set.comparator(); |
| 496 | if (Ordering.natural().equals(comparator) || comparator == null) { |
| 497 | return contains(set.first()) && contains(set.last()); |
| 498 | } |
| 499 | } |
| 500 | for (C value : values) { |
| 501 | if (!contains(value)) { |
| 502 | return false; |
| 503 | } |
| 504 | } |
| 505 | return true; |
| 506 | } |
| 507 | |
| 508 | /** |
| 509 | * Returns {@code true} if the bounds of {@code other} do not extend outside the bounds of this |