NodeStore implements Collection<Node>, NodeIterable { @Override public boolean addAll(final Collection<? extends Node> c) { checkCollection(c); if (!c.isEmpty()) { int capacityNeeded = c.size() - garbageSize; if (capacityNeeded > 0) { ensureCapacity(capacityNeeded); } boolean changed = false; Iterator<? extends Node> itr = c.iterator(); while (itr.hasNext()) { Node e = itr.next(); if (add(e)) { changed = true; } } return changed; } return false; } NodeStore();  NodeStore(final EdgeStore edgeStore, final GraphLock lock, final GraphViewStore viewStore, final GraphVersion graphVersion); NodeImpl get(final int id); NodeImpl get(final Object id); @Override void clear(); @Override int size(); @Override boolean isEmpty(); @Override NodeStoreIterator iterator(); @Override NodeImpl[] toArray(); @Override T[] toArray(T[] array); @Override Collection<Node> toCollection(); @Override boolean add(final Node n); @Override boolean remove(final Object o); @Override boolean contains(final Object o); boolean containsId(final Object id); @Override boolean containsAll(final Collection<?> c); @Override boolean addAll(final Collection<? extends Node> c); @Override boolean removeAll(final Collection<?> c); @Override boolean retainAll(final Collection<?> c); int deepHashCode(); boolean deepEquals(NodeStore obj); @Override void doBreak();  }
@Test public void testAddAll() { NodeStore nodeStore = new NodeStore(); NodeImpl[] nodes = GraphGenerator.generateLargeNodeList(); boolean a = nodeStore.addAll(Arrays.asList(nodes)); Assert.assertEquals(nodeStore.size(), nodes.length); Assert.assertTrue(a); testContainsOnly(nodeStore, Arrays.asList(nodes)); boolean b = nodeStore.addAll(Arrays.asList(nodes)); Assert.assertFalse(b); boolean c = nodeStore.addAll(new ArrayList<Node>()); Assert.assertFalse(c); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testAddAllSelf() { NodeStore nodeStore = new NodeStore(); nodeStore.addAll(nodeStore); }
@Test(expectedExceptions = NullPointerException.class) public void testAddAllNull() { NodeStore nodeStore = new NodeStore(); NodeImpl[] nodes = new NodeImpl[] { new NodeImpl("0"), null }; nodeStore.addAll(Arrays.asList(nodes)); }