@Override public C.List<T> readOnly() { if (isMutable()) { return new ReadOnlyDelegatingList<T>(this); } return this; }
@Override public C.List<T> readOnly() { if (isMutable()) { return new ReadOnlyDelegatingList<T>(this); } return this; }
private C.List<T> unLazyPrepend(Enumeration<? extends T> enumeration) { if (isMutable()) { int pos = 0; while (enumeration.hasMoreElements()) { add(pos++, enumeration.nextElement()); } return this; } ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(enumeration).append(this); return lb.toList(); }
private C.List<T> unLazyPrepend(Enumeration<? extends T> enumeration) { if (isMutable()) { int pos = 0; while (enumeration.hasMoreElements()) { add(pos++, enumeration.nextElement()); } return this; } ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(enumeration).append(this); return lb.toList(); }
private C.List<T> unLazyPrepend(Iterator<? extends T> iterator) { if (isMutable()) { int pos = 0; while (iterator.hasNext()) { add(pos++, iterator.next()); } return this; } ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(iterator).append(this); return lb.toList(); }
private C.List<T> unLazyPrepend(Iterator<? extends T> iterator) { if (isMutable()) { int pos = 0; while (iterator.hasNext()) { add(pos++, iterator.next()); } return this; } ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(iterator).append(this); return lb.toList(); }
private C.List<T> unLazyAppend(Iterator<? extends T> iterator) { if (isMutable()) { C.forEach(iterator, $.visitor(C.F.addTo(this))); return this; } ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(this).append(iterator); return lb.toList(); }
private C.List<T> unLazyAppend(Iterator<? extends T> iterator) { if (isMutable()) { C.forEach(iterator, $.visitor(C.F.addTo(this))); return this; } ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(this).append(iterator); return lb.toList(); }
private C.List<T> unLazyAppend(Enumeration<? extends T> enumeration) { if (isMutable()) { C.forEach(new EnumerationIterator<T>(enumeration), $.visitor(C.F.addTo(this))); return this; } ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(this).append(enumeration); return lb.toList(); }
private C.List<T> unLazyAppend(Enumeration<? extends T> enumeration) { if (isMutable()) { C.forEach(new EnumerationIterator<T>(enumeration), $.visitor(C.F.addTo(this))); return this; } ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(this).append(enumeration); return lb.toList(); }
index = sz + index; if (isMutable()) { addAll(index, subList); return this;
index = sz + index; if (isMutable()) { add(index, t); return this;
private C.List<T> unLazyPrepend(Iterable<? extends T> iterable) { if (isMutable()) { int pos = 0; for (T t : iterable) { add(pos++, t); } return this; } // immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(iterable).append(this); return lb.toList(); } // mutable but read only C.List<T> l = C.newSizedList(size() * 2); l.addAll(iterable); l.addAll(this); return l; }
@Override public C.List<T> append(T t) { if (isMutable()) { add(t); return this; } // Immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() + 1); lb.addAll(this); lb.add(t); return lb.toList(); } // mutable but readonly C.List<T> l = C.newSizedList(size() + 1); l.addAll(this); l.add(t); return l; }
@Override public C.List<T> append(T t) { if (isMutable()) { add(t); return this; } // Immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() + 1); lb.addAll(this); lb.add(t); return lb.toList(); } // mutable but readonly C.List<T> l = C.newSizedList(size() + 1); l.addAll(this); l.add(t); return l; }
private C.List<T> unLazyPrepend(Iterable<? extends T> iterable) { if (isMutable()) { int pos = 0; for (T t : iterable) { add(pos++, t); } return this; } // immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() * 2); lb.append(iterable).append(this); return lb.toList(); } // mutable but read only C.List<T> l = C.newSizedList(size() * 2); l.addAll(iterable); l.addAll(this); return l; }
/** * {@inheritDoc} * For mutable list, this method will insert the * element at {@code 0} position. */ @Override public C.List<T> prepend(T t) { if (isMutable()) { add(0, t); return this; } // immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() + 1); lb.add(t); lb.addAll(this); return lb.toList(); } // readonly but mutable C.List<T> l = C.newSizedList(size() + 1); l.add(t); l.addAll(this); return l; }
/** * {@inheritDoc} * For mutable list, this method will insert the * element at {@code 0} position. */ @Override public C.List<T> prepend(T t) { if (isMutable()) { add(0, t); return this; } // immutable if (isImmutable()) { ListBuilder<T> lb = new ListBuilder<T>(size() + 1); lb.add(t); lb.addAll(this); return lb.toList(); } // readonly but mutable C.List<T> l = C.newSizedList(size() + 1); l.add(t); l.addAll(this); 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; }
@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; }