author | phh |
Sat, 30 Nov 2019 14:33:05 -0800 | |
changeset 59330 | 5b96c12f909d |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
1 |
/* |
23354 | 2 |
* Copyright (c) 2012, 2014, 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 |
|
23354 | 24 |
import java.util.Arrays; |
19855 | 25 |
import java.util.Collection; |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
26 |
import java.util.Collections; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
27 |
import java.util.HashMap; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
28 |
import java.util.HashSet; |
19855 | 29 |
import java.util.Iterator; |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
30 |
import java.util.LinkedHashMap; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
31 |
import java.util.LinkedHashSet; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
32 |
import java.util.LinkedList; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
33 |
import java.util.List; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
34 |
import java.util.Set; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
35 |
|
19855 | 36 |
import java.util.SortedSet; |
37 |
||
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
38 |
import org.testng.annotations.DataProvider; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
39 |
import org.testng.annotations.Test; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
40 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
41 |
import static org.testng.Assert.assertTrue; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
42 |
import static org.testng.Assert.fail; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
43 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
44 |
import java.util.TreeMap; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
45 |
import java.util.TreeSet; |
19855 | 46 |
import java.util.concurrent.ConcurrentHashMap; |
47 |
import java.util.concurrent.ConcurrentSkipListMap; |
|
23354 | 48 |
import java.util.function.Function; |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
49 |
import java.util.function.Predicate; |
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 |
/** |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
52 |
* @test |
19855 | 53 |
* @summary Unit tests for extension methods on Collection |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
54 |
* @library testlibrary |
19855 | 55 |
* @build CollectionAsserts CollectionSupplier ExtendsAbstractSet ExtendsAbstractCollection |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
56 |
* @run testng CollectionDefaults |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
57 |
*/ |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
58 |
public class CollectionDefaults { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
59 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
60 |
public static final Predicate<Integer> pEven = x -> 0 == x % 2; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
61 |
public static final Predicate<Integer> pOdd = x -> 1 == x % 2; |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
62 |
|
42319 | 63 |
private static final int SIZE = 100; |
64 |
||
23354 | 65 |
private static final List<Function<Collection<Integer>, Collection<Integer>>> TEST_SUPPLIERS = Arrays.asList( |
66 |
// Collection |
|
67 |
ExtendsAbstractCollection<Integer>::new, |
|
42319 | 68 |
java.util.ArrayDeque<Integer>::new, |
69 |
java.util.concurrent.ConcurrentLinkedDeque<Integer>::new, |
|
70 |
java.util.concurrent.ConcurrentLinkedQueue<Integer>::new, |
|
71 |
java.util.concurrent.LinkedBlockingDeque<Integer>::new, |
|
72 |
java.util.concurrent.LinkedBlockingQueue<Integer>::new, |
|
73 |
java.util.concurrent.LinkedTransferQueue<Integer>::new, |
|
74 |
(coll) -> new java.util.concurrent.ArrayBlockingQueue<Integer>( |
|
75 |
3 * SIZE, false, coll), |
|
19855 | 76 |
|
23354 | 77 |
// Lists |
78 |
java.util.ArrayList<Integer>::new, |
|
79 |
java.util.LinkedList<Integer>::new, |
|
80 |
java.util.Vector<Integer>::new, |
|
81 |
java.util.concurrent.CopyOnWriteArrayList<Integer>::new, |
|
82 |
ExtendsAbstractList<Integer>::new, |
|
19855 | 83 |
|
23354 | 84 |
// Sets |
85 |
java.util.HashSet<Integer>::new, |
|
86 |
java.util.LinkedHashSet<Integer>::new, |
|
87 |
java.util.TreeSet<Integer>::new, |
|
88 |
java.util.concurrent.ConcurrentSkipListSet<Integer>::new, |
|
89 |
java.util.concurrent.CopyOnWriteArraySet<Integer>::new, |
|
90 |
ExtendsAbstractSet<Integer>::new |
|
91 |
); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
92 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
93 |
@DataProvider(name="setProvider", parallel=true) |
19855 | 94 |
public static Iterator<Object[]> setCases() { |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
95 |
final List<Object[]> cases = new LinkedList<>(); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
96 |
cases.add(new Object[] { new HashSet<>() }); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
97 |
cases.add(new Object[] { new LinkedHashSet<>() }); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
98 |
cases.add(new Object[] { new TreeSet<>() }); |
19855 | 99 |
cases.add(new Object[] { new java.util.concurrent.ConcurrentSkipListSet<>() }); |
100 |
cases.add(new Object[] { new java.util.concurrent.CopyOnWriteArraySet<>() }); |
|
101 |
||
102 |
cases.add(new Object[] { new ExtendsAbstractSet<>() }); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
103 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
104 |
cases.add(new Object[] { Collections.newSetFromMap(new HashMap<>()) }); |
23354 | 105 |
cases.add(new Object[] { Collections.newSetFromMap(new LinkedHashMap<>()) }); |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
106 |
cases.add(new Object[] { Collections.newSetFromMap(new TreeMap<>()) }); |
19855 | 107 |
cases.add(new Object[] { Collections.newSetFromMap(new ConcurrentHashMap<>()) }); |
108 |
cases.add(new Object[] { Collections.newSetFromMap(new ConcurrentSkipListMap<>()) }); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
109 |
|
19855 | 110 |
cases.add(new Object[] { new HashSet<Integer>(){{add(42);}} }); |
111 |
cases.add(new Object[] { new ExtendsAbstractSet<Integer>(){{add(42);}} }); |
|
112 |
cases.add(new Object[] { new LinkedHashSet<Integer>(){{add(42);}} }); |
|
113 |
cases.add(new Object[] { new TreeSet<Integer>(){{add(42);}} }); |
|
114 |
return cases.iterator(); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
115 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
116 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
117 |
@Test(dataProvider = "setProvider") |
23354 | 118 |
public void testProvidedWithNull(final Set<Integer> set) { |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
119 |
try { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
120 |
set.forEach(null); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
121 |
fail("expected NPE not thrown"); |
23354 | 122 |
} catch (NullPointerException expected) { // expected |
123 |
} |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
124 |
try { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
125 |
set.removeIf(null); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
126 |
fail("expected NPE not thrown"); |
23354 | 127 |
} catch (NullPointerException expected) { // expected |
19855 | 128 |
} |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
129 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
130 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
131 |
@Test |
23354 | 132 |
public void testForEach() { |
133 |
@SuppressWarnings("unchecked") |
|
134 |
final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier(TEST_SUPPLIERS, SIZE); |
|
19855 | 135 |
|
136 |
for (final CollectionSupplier.TestCase<Collection<Integer>> test : supplier.get()) { |
|
137 |
final Collection<Integer> original = test.expected; |
|
138 |
final Collection<Integer> set = test.collection; |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
139 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
140 |
try { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
141 |
set.forEach(null); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
142 |
fail("expected NPE not thrown"); |
23354 | 143 |
} catch (NullPointerException expected) { // expected |
19855 | 144 |
} |
145 |
if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) { |
|
146 |
CollectionAsserts.assertContentsUnordered(set, original, test.toString()); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
147 |
} else { |
19855 | 148 |
CollectionAsserts.assertContents(set, original, test.toString()); |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
149 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
150 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
151 |
final List<Integer> actual = new LinkedList<>(); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
152 |
set.forEach(actual::add); |
19855 | 153 |
if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) { |
154 |
CollectionAsserts.assertContentsUnordered(actual, set, test.toString()); |
|
155 |
CollectionAsserts.assertContentsUnordered(actual, original, test.toString()); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
156 |
} else { |
19855 | 157 |
CollectionAsserts.assertContents(actual, set, test.toString()); |
158 |
CollectionAsserts.assertContents(actual, original, test.toString()); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
159 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
160 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
161 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
162 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
163 |
@Test |
23354 | 164 |
public void testRemoveIf() { |
165 |
@SuppressWarnings("unchecked") |
|
166 |
final CollectionSupplier<Collection<Integer>> supplier = new CollectionSupplier(TEST_SUPPLIERS, SIZE); |
|
19855 | 167 |
for (final CollectionSupplier.TestCase<Collection<Integer>> test : supplier.get()) { |
168 |
final Collection<Integer> original = test.expected; |
|
169 |
final Collection<Integer> set = test.collection; |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
170 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
171 |
try { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
172 |
set.removeIf(null); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
173 |
fail("expected NPE not thrown"); |
23354 | 174 |
} catch (NullPointerException expected) { // expected |
19855 | 175 |
} |
176 |
if (set instanceof Set && !((set instanceof SortedSet) || (set instanceof LinkedHashSet))) { |
|
177 |
CollectionAsserts.assertContentsUnordered(set, original, test.toString()); |
|
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
178 |
} else { |
19855 | 179 |
CollectionAsserts.assertContents(set, original, test.toString()); |
17166
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
180 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
181 |
|
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
182 |
set.removeIf(pEven); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
183 |
for (int i : set) { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
184 |
assertTrue((i % 2) == 1); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
185 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
186 |
for (int i : original) { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
187 |
if (i % 2 == 1) { |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
188 |
assertTrue(set.contains(i)); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
189 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
190 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
191 |
set.removeIf(pOdd); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
192 |
assertTrue(set.isEmpty()); |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
193 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
194 |
} |
c83a0fa44906
8001647: default methods for Collections - forEach, removeIf, replaceAll, sort
akhil
parents:
diff
changeset
|
195 |
} |