author | lana |
Thu, 26 Dec 2013 12:04:16 -0800 | |
changeset 23010 | 6dadb192ad81 |
parent 19855 | bfe130545fe0 |
child 23354 | 221bf0e3642d |
permissions | -rw-r--r-- |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
19855
diff
changeset
|
2 |
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
4 |
* |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
8 |
* |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
13 |
* accompanied this code). |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
14 |
* |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
18 |
* |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
21 |
* questions. |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
22 |
*/ |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
23 |
|
19855 | 24 |
import java.util.Collection; |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
25 |
import java.util.Collections; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
26 |
import java.util.HashMap; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
27 |
import java.util.HashSet; |
19855 | 28 |
import java.util.Iterator; |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
29 |
import java.util.LinkedHashMap; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
30 |
import java.util.LinkedHashSet; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
31 |
import java.util.LinkedList; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
32 |
import java.util.List; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
33 |
import java.util.Set; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
34 |
|
19855 | 35 |
import java.util.SortedSet; |
36 |
||
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
37 |
import org.testng.annotations.DataProvider; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
38 |
import org.testng.annotations.Test; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
39 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
40 |
import static org.testng.Assert.assertTrue; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
41 |
import static org.testng.Assert.fail; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
42 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
43 |
import java.util.TreeMap; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
44 |
import java.util.TreeSet; |
19855 | 45 |
import java.util.concurrent.ConcurrentHashMap; |
46 |
import java.util.concurrent.ConcurrentSkipListMap; |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
47 |
import java.util.function.Predicate; |
19855 | 48 |
import java.util.function.Supplier; |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
49 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
50 |
/** |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
51 |
* @test |
19855 | 52 |
* @summary Unit tests for extension methods on Collection |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
53 |
* @library testlibrary |
19855 | 54 |
* @build CollectionAsserts CollectionSupplier ExtendsAbstractSet ExtendsAbstractCollection |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
55 |
* @run testng CollectionDefaults |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
56 |
*/ |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
57 |
public class CollectionDefaults { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
58 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
59 |
public static final Predicate<Integer> pEven = x -> 0 == x % 2; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
60 |
public static final Predicate<Integer> pOdd = x -> 1 == x % 2; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
61 |
|
19855 | 62 |
@SuppressWarnings("unchecked") |
63 |
private static final Supplier<?>[] TEST_CLASSES = { |
|
64 |
// Collection |
|
65 |
ExtendsAbstractCollection<Integer>::new, |
|
66 |
||
67 |
// Lists |
|
68 |
java.util.ArrayList<Integer>::new, |
|
69 |
java.util.LinkedList<Integer>::new, |
|
70 |
java.util.Vector<Integer>::new, |
|
71 |
java.util.concurrent.CopyOnWriteArrayList<Integer>::new, |
|
72 |
ExtendsAbstractList<Integer>::new, |
|
73 |
||
74 |
// Sets |
|
75 |
java.util.HashSet<Integer>::new, |
|
76 |
java.util.LinkedHashSet<Integer>::new, |
|
77 |
java.util.TreeSet<Integer>::new, |
|
78 |
java.util.concurrent.ConcurrentSkipListSet<Integer>::new, |
|
79 |
java.util.concurrent.CopyOnWriteArraySet<Integer>::new, |
|
80 |
ExtendsAbstractSet<Integer>::new |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
81 |
}; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
82 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
83 |
private static final int SIZE = 100; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
84 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
85 |
@DataProvider(name="setProvider", parallel=true) |
19855 | 86 |
public static Iterator<Object[]> setCases() { |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
87 |
final List<Object[]> cases = new LinkedList<>(); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
88 |
cases.add(new Object[] { new HashSet<>() }); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
89 |
cases.add(new Object[] { new LinkedHashSet<>() }); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
90 |
cases.add(new Object[] { new TreeSet<>() }); |
19855 | 91 |
cases.add(new Object[] { new java.util.concurrent.ConcurrentSkipListSet<>() }); |
92 |
cases.add(new Object[] { new java.util.concurrent.CopyOnWriteArraySet<>() }); |
|
93 |
||
94 |
cases.add(new Object[] { new ExtendsAbstractSet<>() }); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
95 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
96 |
cases.add(new Object[] { Collections.newSetFromMap(new HashMap<>()) }); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
97 |
cases.add(new Object[] { Collections.newSetFromMap(new LinkedHashMap()) }); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
98 |
cases.add(new Object[] { Collections.newSetFromMap(new TreeMap<>()) }); |
19855 | 99 |
cases.add(new Object[] { Collections.newSetFromMap(new ConcurrentHashMap<>()) }); |
100 |
cases.add(new Object[] { Collections.newSetFromMap(new ConcurrentSkipListMap<>()) }); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
101 |
|
19855 | 102 |
cases.add(new Object[] { new HashSet<Integer>(){{add(42);}} }); |
103 |
cases.add(new Object[] { new ExtendsAbstractSet<Integer>(){{add(42);}} }); |
|
104 |
cases.add(new Object[] { new LinkedHashSet<Integer>(){{add(42);}} }); |
|
105 |
cases.add(new Object[] { new TreeSet<Integer>(){{add(42);}} }); |
|
106 |
return cases.iterator(); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
107 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
108 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
109 |
@Test(dataProvider = "setProvider") |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
110 |
public void testProvidedWithNull(final Set<Integer> set) throws Exception { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
111 |
try { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
112 |
set.forEach(null); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
113 |
fail("expected NPE not thrown"); |
19855 | 114 |
} catch (NullPointerException expected) { |
115 |
; // expected |
|
116 |
} |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
117 |
try { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
118 |
set.removeIf(null); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
119 |
fail("expected NPE not thrown"); |
19855 | 120 |
} catch (NullPointerException expected) { |
121 |
; // expected |
|
122 |
} |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
123 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
124 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
125 |
@Test |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
126 |
public void testForEach() throws Exception { |
19855 | 127 |
final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier((Supplier<Collection<Integer>>[]) TEST_CLASSES, SIZE); |
128 |
||
129 |
for (final CollectionSupplier.TestCase<Collection<Integer>> test : supplier.get()) { |
|
130 |
final Collection<Integer> original = test.expected; |
|
131 |
final Collection<Integer> set = test.collection; |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
132 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
133 |
try { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
134 |
set.forEach(null); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
135 |
fail("expected NPE not thrown"); |
19855 | 136 |
} catch (NullPointerException expected) { |
137 |
; // expected |
|
138 |
} |
|
139 |
if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) { |
|
140 |
CollectionAsserts.assertContentsUnordered(set, original, test.toString()); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
141 |
} else { |
19855 | 142 |
CollectionAsserts.assertContents(set, original, test.toString()); |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
143 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
144 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
145 |
final List<Integer> actual = new LinkedList<>(); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
146 |
set.forEach(actual::add); |
19855 | 147 |
if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) { |
148 |
CollectionAsserts.assertContentsUnordered(actual, set, test.toString()); |
|
149 |
CollectionAsserts.assertContentsUnordered(actual, original, test.toString()); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
150 |
} else { |
19855 | 151 |
CollectionAsserts.assertContents(actual, set, test.toString()); |
152 |
CollectionAsserts.assertContents(actual, original, test.toString()); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
153 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
154 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
155 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
156 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
157 |
@Test |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
158 |
public void testRemoveIf() throws Exception { |
19855 | 159 |
final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier((Supplier<Collection<Integer>>[]) TEST_CLASSES, SIZE); |
160 |
for (final CollectionSupplier.TestCase<Collection<Integer>> test : supplier.get()) { |
|
161 |
final Collection<Integer> original = test.expected; |
|
162 |
final Collection<Integer> set = test.collection; |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
163 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
164 |
try { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
165 |
set.removeIf(null); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
166 |
fail("expected NPE not thrown"); |
19855 | 167 |
} catch (NullPointerException expected) { |
168 |
; // expected |
|
169 |
} |
|
170 |
if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) { |
|
171 |
CollectionAsserts.assertContentsUnordered(set, original, test.toString()); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
172 |
} else { |
19855 | 173 |
CollectionAsserts.assertContents(set, original, test.toString()); |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
174 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
175 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
176 |
set.removeIf(pEven); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
177 |
for (int i : set) { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
178 |
assertTrue((i % 2) == 1); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
179 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
180 |
for (int i : original) { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
181 |
if (i % 2 == 1) { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
182 |
assertTrue(set.contains(i)); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
183 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
184 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
185 |
set.removeIf(pOdd); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
186 |
assertTrue(set.isEmpty()); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
187 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
188 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
189 |
} |