public boolean addAll(int index, Collection<? extends E> c) { if (index < 0 || index > size) throw new IndexOutOfBoundsException( "Index: " + index + ", Size: " + size); int cSize = c.size(); if (cSize == 0) return false; checkForComodification(); l.addAll(offset + index, c); expectedModCount = l.modCount(); size += cSize; modCount++; return true; }
public boolean addAll(int index, Collection<? extends E> c) { if (index < 0 || index > size) throw new IndexOutOfBoundsException( "Index: " + index + ", Size: " + size); int cSize = c.size(); if (cSize == 0) return false; checkForComodification(); l.addAll(offset + index, c); expectedModCount = l.modCount(); size += cSize; modCount++; return true; }
addAll(index, subList); return this;
addAll(index, subList); return this;
@SuppressWarnings("unchecked") private C.List<T> unLazyAppend(Iterable<? extends T> iterable) { if (isMutable()) { if (iterable instanceof Collection) { addAll((Collection<? extends T>) iterable); } else { C.forEach(iterable, $.visitor(C.F.addTo(this))); } return this; } // immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(this).append(iterable); return lb.toList(); } // mutable but read only C.List<T> l = C.newSizedList(size() * 2); l.addAll(this); l.addAll(iterable); return l; }
@SuppressWarnings("unchecked") private C.List<T> unLazyAppend(Iterable<? extends T> iterable) { if (isMutable()) { if (iterable instanceof Collection) { addAll((Collection<? extends T>) iterable); } else { C.forEach(iterable, $.visitor(C.F.addTo(this))); } return this; } // immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(this).append(iterable); return lb.toList(); } // mutable but read only C.List<T> l = C.newSizedList(size() * 2); l.addAll(this); l.addAll(iterable); return l; }