public void add(int index, T element) { listAdapter.add(index, element); } public boolean add(T e) {
public void add(int index, T element) { adapter.add(index, element); } public boolean add(T e) {
public boolean add(T e) { return adapter.add(e); } public boolean addAll(Collection<? extends T> c) {
public boolean add(T e) { return listAdapter.add(e); } public boolean addAll(Collection<? extends T> c) {
@Override public void add(int location, E object) { if (modCount == fullList.modCount) { if (location >= 0 && location <= size) { fullList.add(location + offset, object); size++; modCount = fullList.modCount; } else { throw new IndexOutOfBoundsException(); } } else { throw new ConcurrentModificationException(); } }
@Override public boolean add(E e) { ensureIsMutable(); return super.add(e); }
@Override public void add(int index, E element) { ensureIsMutable(); super.add(index, element); }
/** * Inserts the objects in the specified Collection at the specified location * in this List. The objects are added in the order they are returned from * the collection's iterator. * * @param location * the index at which to insert. * @param collection * the Collection of objects * @return {@code true} if this List is modified, {@code false} otherwise. * @throws UnsupportedOperationException * if adding to this list is not supported. * @throws ClassCastException * if the class of an object is inappropriate for this list. * @throws IllegalArgumentException * if an object cannot be added to this list. * @throws IndexOutOfBoundsException * if {@code location < 0 || location > size()} */ public boolean addAll(int location, Collection<? extends E> collection) { Iterator<? extends E> it = collection.iterator(); while (it.hasNext()) { add(location++, it.next()); } return !collection.isEmpty(); }
/** * Adds the specified object at the end of this List. * * * @param object * the object to add * @return true * * @throws UnsupportedOperationException * if adding to this List is not supported * @throws ClassCastException * if the class of the object is inappropriate for this * List * @throws IllegalArgumentException * if the object cannot be added to this List */ @Override public boolean add(E object) { add(size(), object); return true; }
void onSearch(String s) { mSearch = s; if (mAdapter != null) { if (TextUtils.isEmpty(s)) { mAdapter.clear(); mAdapter.setNewList(mIcons); } else { AbstractList<IconItem> tmpList = new ArrayList<>(); for (IconItem icon : mIcons) { if (icon.getIcon().toLowerCase().contains(s.toLowerCase())) { tmpList.add(icon); } } mAdapter.setNewList(tmpList); } } }
private static void assertToPartitionValues(String partitionName) throws MetaException { List<String> actual = toPartitionValues(partitionName); AbstractList<String> expected = new ArrayList<>(); for (String s : actual) { expected.add(null); } Warehouse.makeValsFromName(partitionName, expected); assertEquals(actual, expected); }
/** * Extracts values from partition name without the column names. * @param name Partition name. * @param result The result. Must be pre-sized to the expected number of columns. */ public static AbstractList<String> makeValsFromName( String name, AbstractList<String> result) throws MetaException { assert name != null; String[] parts = slash.split(name, 0); if (result == null) { result = new ArrayList<>(parts.length); for (int i = 0; i < parts.length; ++i) { result.add(null); } } else if (parts.length != result.size()) { throw new MetaException( "Expected " + result.size() + " components, got " + parts.length + " (" + name + ")"); } for (int i = 0; i < parts.length; ++i) { int eq = parts[i].indexOf('='); if (eq <= 0) { throw new MetaException("Unexpected component " + parts[i]); } result.set(i, unescapePathName(parts[i].substring(eq + 1))); } return result; }
@Override public boolean add(T t) { boolean b = super.add(t); if (b) { sorted = false; } return b; }
@Override public boolean add(final E e) { final boolean localAddResult = super.add(e); return (localAddResult && addResult.get()); }
public static <T> List<T> toList(Enumeration<? extends T> things) { AbstractList<T> list = new ArrayList<T>(); while (things.hasMoreElements()) { list.add(things.nextElement()); } return list; }
@Override public boolean add(E e) { ensureIsMutable(); return super.add(e); }
@Override public void add(int index, E element) { ensureIsMutable(); super.add(index, element); }
private static void assertToPartitionValues(String partitionName) throws MetaException { List<String> actual = toPartitionValues(partitionName); AbstractList<String> expected = new ArrayList<>(); for (String s : actual) { expected.add(null); } Warehouse.makeValsFromName(partitionName, expected); assertEquals(actual, expected); }
@Test public void testPrepare10() throws Throwable { HasEntry hasEntry = new HasEntry(); AbstractList<TransactionParticipant> arrayList = new ArrayList(); arrayList.add(new Debug()); int result = transactionManager.prepare(1, 100L, new NotActiveException("testTransactionManagerParam1"), members, arrayList.iterator(), members.add(hasEntry), null, null); assertEquals("(ArrayList) members.size()", 2, members.size()); assertSame("(ArrayList) members.get(0)", hasEntry, members.get(0)); assertEquals("result", 0, result); }
@Test public void testPrepare8() throws Throwable { AbstractList<TransactionParticipant> arrayList = new ArrayList(1000); arrayList.add(new HasEntry()); LogEvent evt = new LogEvent(); int result = transactionManager.prepare(1, 100L, Boolean.TRUE, new ArrayList(), arrayList.iterator(), false, evt, null); assertEquals("evt.payLoad.size()", 3, evt.getPayLoad().size()); assertEquals("result", TransactionConstants.PREPARED, result); }