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

Method elementsEqual

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

Determines whether two iterables contain equal elements in the same order. More specifically, this method returns true if iterable1 and iterable2 contain the same number of elements and every element of iterable1 is equal to the corresponding element of {@code iterabl

(Iterable<?> iterable1, Iterable<?> iterable2)

Source from the content-addressed store, hash-verified

264 * {@code iterable2}.
265 */
266 public static boolean elementsEqual(Iterable<?> iterable1, Iterable<?> iterable2) {
267 if (iterable1 instanceof Collection && iterable2 instanceof Collection) {
268 Collection<?> collection1 = (Collection<?>) iterable1;
269 Collection<?> collection2 = (Collection<?>) iterable2;
270 if (collection1.size() != collection2.size()) {
271 return false;
272 }
273 }
274 return Iterators.elementsEqual(iterable1.iterator(), iterable2.iterator());
275 }
276
277 /**
278 * Returns a string representation of {@code iterable}, with the format {@code

Callers

nothing calls this directly

Calls 3

elementsEqualMethod · 0.95
sizeMethod · 0.65
iteratorMethod · 0.65

Tested by

no test coverage detected