MCPcopy Create free account
hub / github.com/antlr/codebuff / cycle

Method cycle

corpus/java/training/guava/collect/Iterables.java:400–413  ·  view source on GitHub ↗

Returns an iterable whose iterators cycle indefinitely over the elements of iterable. That iterator supports remove() if iterable.iterator() does. After remove() is called, subsequent cycles omit the removed element, which is no longer in iterable. The ite

(final Iterable<T> iterable)

Source from the content-addressed store, hash-verified

398 * {@code Iterables.concat(Collections.nCopies(n, iterable))}
399 */
400 public static <T> Iterable<T> cycle(final Iterable<T> iterable) {
401 checkNotNull(iterable);
402 return new FluentIterable<T>() {
403 @Override
404 public Iterator<T> iterator() {
405 return Iterators.cycle(iterable);
406 }
407
408 @Override
409 public String toString() {
410 return iterable.toString() + " (cycled)";
411 }
412 };
413 }
414
415 /**
416 * Returns an iterable whose iterators cycle indefinitely over the provided

Callers 1

cycleMethod · 0.95

Calls 2

newArrayListMethod · 0.95
checkNotNullMethod · 0.45

Tested by

no test coverage detected