Code example for CopyOnWriteArrayList

Methods: addAllremoveAll

0
        } catch (ConcurrentModificationException expected) {
        } 
    } 
 
    public void testRemoveAll() { 
        CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList<String>();
        list.addAll(Arrays.asList("a", "b", "c", "d", "e"));
 
        list.removeAll(Arrays.asList());
        assertEquals(Arrays.asList("a", "b", "c", "d", "e"), list);
 
        list.removeAll(Arrays.asList("e"));
        assertEquals(Arrays.asList("a", "b", "c", "d"), list);
 
        list.removeAll(Arrays.asList("b", "c"));
        assertEquals(Arrays.asList("a", "d"), list);
    } 
 
    public void testSubListClear() { 
        CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList<String>();
Experience pair programming with AI  Get Codota for Java