### Question:
ArrayTagSet implements TagList { ArrayTagSet addAll(Iterable<Tag> ts) { if (ts instanceof Collection) { Collection<Tag> data = (Collection<Tag>) ts; if (data.isEmpty()) { return this; } else { String[] newTags = new String[2 * data.size()]; int i = 0; for (Tag t : data) { newTags[i++] = t.key(); newTags[i++] = t.value(); } checkForNullValues(newTags); return addAll(newTags, newTags.length); } } else { List<Tag> data = new ArrayList<>(); for (Tag t : ts) { data.add(t); } return addAll(data); } } private  ArrayTagSet(String[] tags); private  ArrayTagSet(String[] tags, int length); @Override String getKey(int i); @Override String getValue(int i); @Override int size(); @Override ArrayTagSet filter(BiPredicate<String, String> predicate); @Override ArrayTagSet filterByKey(Predicate<String> predicate); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void addAllTagArrayEmpty() { ArrayTagSet ts = ArrayTagSet.EMPTY.addAll(new Tag[0]); Assertions.assertSame(ArrayTagSet.EMPTY, ts); }
@Test public void addAllStringArrayEmpty() { ArrayTagSet ts = ArrayTagSet.EMPTY.addAll(new String[0]); Assertions.assertSame(ArrayTagSet.EMPTY, ts); }
@Test public void addAllIterable() { Collection<Tag> tags = Collections.singletonList(new BasicTag("app", "foo")); ArrayTagSet ts = ArrayTagSet.EMPTY.addAll(tags::iterator); Assertions.assertEquals(ArrayTagSet.EMPTY.addAll(tags), ts); }
@Test public void addAllConcurrentMapFailure() throws InterruptedException { final AtomicBoolean done = new AtomicBoolean(false); final Map<String, String> tags = new ConcurrentHashMap<>(); Thread t1 = new Thread(() -> { while (!done.get()) { tags.remove("app"); } }); t1.start(); Thread t2 = new Thread(() -> { while (!done.get()) { tags.put("app", "foo"); } }); t2.start(); try { for (int i = 0; i < 10_000; ++i) { ArrayTagSet.EMPTY.addAll(tags); } } finally { done.set(true); t1.join(); t2.join(); } }