KT-19565: J2K: Determine mutability using iterator
#KT-19565 fixed
This commit is contained in:
committed by
Simon Ogorodnik
parent
d312996f3a
commit
0722c5c13a
@@ -0,0 +1,19 @@
|
||||
import java.util.*;
|
||||
|
||||
class Iterator {
|
||||
|
||||
Map<String, String> mutableMap1 = new HashMap<>();
|
||||
Map<String, String> mutableMap2 = new HashMap<>();
|
||||
|
||||
void testFields() {
|
||||
mutableMap1.values().add("")
|
||||
mutableMap2.entrySet().iterator().remove();
|
||||
}
|
||||
|
||||
void testFunctionParameters(Collection<String> immutableCollection, List<Integer> mutableList) {
|
||||
for (Iterator<String> it = immutableCollection.iterator(); it.hasNext(); ) {
|
||||
it.next();
|
||||
}
|
||||
mutableList.listIterator().add(2);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user