MCPcopy
hub / github.com/google/guava / addAll

Method addAll

guava/src/com/google/common/collect/Iterators.java:363–373  ·  view source on GitHub ↗

Adds all elements in {@code iterator} to {@code collection}. The iterator will be left exhausted: its {@code hasNext()} method will return {@code false}. @return {@code true} if {@code collection} was modified as a result of this operation

(
      Collection<T> addTo, Iterator<? extends T> iterator)

Source from the content-addressed store, hash-verified

361 * @return {@code true} if {@code collection} was modified as a result of this operation
362 */
363 @CanIgnoreReturnValue
364 public static <T extends @Nullable Object> boolean addAll(
365 Collection<T> addTo, Iterator<? extends T> iterator) {
366 checkNotNull(addTo);
367 checkNotNull(iterator);
368 boolean wasModified = false;
369 while (iterator.hasNext()) {
370 wasModified |= addTo.add(iterator.next());
371 }
372 return wasModified;
373 }
374
375 /**
376 * Returns the number of elements in the specified iterator that equal the specified object. The

Callers 14

snapshotMethod · 0.95
copyOfMethod · 0.95
addAllMethod · 0.95
newArrayListMethod · 0.95
addAllImplMethod · 0.95
putAllMethod · 0.95
immutableEnumSetMethod · 0.95
newHashSetMethod · 0.95
standardAddAllMethod · 0.95
snapshotMethod · 0.95
testAddAllToListMethod · 0.95

Calls 4

addMethod · 0.65
nextMethod · 0.65
checkNotNullMethod · 0.45
hasNextMethod · 0.45

Tested by 5

snapshotMethod · 0.76
testAddAllToListMethod · 0.76
testAddAllToSetMethod · 0.76