Lines Matching refs:list

10 // notice, this list of conditions and the following disclaimer.
12 // copyright notice, this list of conditions and the following disclaimer
51 private ProtobufArrayList<Integer> list;
55 list = new ProtobufArrayList<Integer>();
67 list.addAll(asList(1, 2, 3, 4));
68 Iterator<Integer> iterator = list.iterator();
69 assertEquals(4, list.size());
70 assertEquals(1, (int) list.get(0));
73 list.remove(0);
81 iterator = list.iterator();
82 list.set(0, 1);
90 iterator = list.iterator();
91 list.add(0, 0);
101 list.add(2);
102 list.add(4);
103 list.add(6);
104 list.add(8);
105 list.makeImmutable();
106 assertImmutable(list);
110 list.add(2);
111 list.add(4);
112 list.add(6);
114 list.remove(1);
115 assertEquals(asList(2, 6), list);
117 list.remove(1);
118 assertEquals(asList(2), list);
120 list.remove(0);
121 assertEquals(asList(), list);
125 list.add(2);
126 list.add(6);
128 assertEquals(2, (int) list.get(0));
129 assertEquals(6, (int) list.get(1));
133 list.add(2);
134 list.add(6);
136 list.set(0, 1);
137 assertEquals(1, (int) list.get(0));
138 list.set(1, 2);
139 assertEquals(2, (int) list.get(1));
142 private void assertImmutable(List<Integer> list) {
143 if (list.contains(1)) {
148 list.add(1);
155 list.add(0, 1);
162 list.addAll(Collections.<Integer>emptyList());
169 list.addAll(Collections.singletonList(1));
176 list.addAll(new ProtobufArrayList<Integer>());
183 list.addAll(UNARY_LIST);
190 list.addAll(0, Collections.singleton(1));
197 list.addAll(0, UNARY_LIST);
204 list.addAll(0, Collections.<Integer>emptyList());
211 list.clear();
218 list.remove(1);
225 list.remove(new Object());
232 list.removeAll(Collections.emptyList());
239 list.removeAll(Collections.singleton(1));
246 list.removeAll(UNARY_LIST);
253 list.retainAll(Collections.emptyList());
260 list.retainAll(Collections.singleton(1));
267 list.retainAll(UNARY_LIST);
274 list.set(0, 0);
282 ProtobufArrayList<Integer> list = new ProtobufArrayList<Integer>();
284 list.add(element);
286 list.makeImmutable();
287 return list;