void () { DisposableWrapperList<String> l = new DisposableWrapperList<>(); Disposable d1 = Disposer.newDisposable(); assertNotNull(l.add("a", d1)); assertNotNull(l.add("b", d1)); Disposable d2 = Disposer.newDisposable(); assertNotNull(l.add("a", d2)); assertNotNull(l.add("b", d2)); assertEquals(4, l.size()); assertEquals(0, l.indexOf("a")); assertEquals(2, l.lastIndexOf("a")); assertTrue(l.remove("a")); assertEquals(3, l.size()); assertTrue(l.contains("a")); Disposer.dispose(d2); assertEquals(1, l.size()); Disposer.dispose(d1); assertTrue(l.isEmpty()); }