mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-03 03:37:58 +07:00
The object may be only shallowly unmodifiable GitOrigin-RevId: 41c0a0b46fc80169ff334d6337d9f8708e689448
18 lines
354 B
Java
18 lines
354 B
Java
import java.util.*;
|
|
|
|
public class ArrayAddedIntoCollection {
|
|
public static void main(String[] args) {
|
|
int[] data = {-1};
|
|
List<int[]> wrapped = new ArrayList<>();
|
|
wrapped.add(wrap(data));
|
|
wrapped.get(0)[0] = 0;
|
|
if (data[0] == 0) {
|
|
System.out.println("oops");
|
|
}
|
|
}
|
|
|
|
static int[] wrap(int[] data) {
|
|
return data;
|
|
}
|
|
}
|