Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/protobuf/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Protocol Buffers - Google's data interchange format 1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved. 2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/ 3 // https://developers.google.com/protocol-buffers/
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 14 matching lines...) Expand all
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 package com.google.protobuf; 31 package com.google.protobuf;
32 32
33 import static java.util.Arrays.asList; 33 import static java.util.Arrays.asList;
34 34
35 import junit.framework.TestCase;
36
37 import java.util.Collections; 35 import java.util.Collections;
38 import java.util.ConcurrentModificationException; 36 import java.util.ConcurrentModificationException;
39 import java.util.Iterator; 37 import java.util.Iterator;
38 import junit.framework.TestCase;
40 39
41 /** 40 /**
42 * Tests for {@link FloatArrayList}. 41 * Tests for {@link FloatArrayList}.
43 * 42 *
44 * @author dweis@google.com (Daniel Weis) 43 * @author dweis@google.com (Daniel Weis)
45 */ 44 */
46 public class FloatArrayListTest extends TestCase { 45 public class FloatArrayListTest extends TestCase {
47 46
48 private static final FloatArrayList UNARY_LIST = newImmutableFloatArrayList(1) ; 47 private static final FloatArrayList UNARY_LIST =
48 newImmutableFloatArrayList(1);
49 private static final FloatArrayList TERTIARY_LIST = 49 private static final FloatArrayList TERTIARY_LIST =
50 newImmutableFloatArrayList(1, 2, 3); 50 newImmutableFloatArrayList(1, 2, 3);
51 51
52 private FloatArrayList list; 52 private FloatArrayList list;
53 53
54 @Override 54 @Override
55 protected void setUp() throws Exception { 55 protected void setUp() throws Exception {
56 list = new FloatArrayList(); 56 list = new FloatArrayList();
57 } 57 }
58 58
59 public void testEmptyListReturnsSameInstance() { 59 public void testEmptyListReturnsSameInstance() {
60 assertSame(FloatArrayList.emptyList(), FloatArrayList.emptyList()); 60 assertSame(FloatArrayList.emptyList(), FloatArrayList.emptyList());
61 } 61 }
62 62
63 public void testEmptyListIsImmutable() { 63 public void testEmptyListIsImmutable() {
64 assertImmutable(FloatArrayList.emptyList()); 64 assertImmutable(FloatArrayList.emptyList());
65 } 65 }
66 66
67 public void testMakeImmutable() { 67 public void testMakeImmutable() {
68 list.addFloat(2); 68 list.addFloat(3);
69 list.addFloat(4); 69 list.addFloat(4);
70 list.addFloat(6); 70 list.addFloat(5);
71 list.addFloat(8); 71 list.addFloat(7);
72 list.makeImmutable(); 72 list.makeImmutable();
73 assertImmutable(list); 73 assertImmutable(list);
74 } 74 }
75 75
76 public void testModificationWithIteration() { 76 public void testModificationWithIteration() {
77 list.addAll(asList(1F, 2F, 3F, 4F)); 77 list.addAll(asList(1F, 2F, 3F, 4F));
78 Iterator<Float> iterator = list.iterator(); 78 Iterator<Float> iterator = list.iterator();
79 assertEquals(4, list.size()); 79 assertEquals(4, list.size());
80 assertEquals(1F, (float) list.get(0)); 80 assertEquals(1F, (float) list.get(0));
81 assertEquals(1F, (float) iterator.next()); 81 assertEquals(1F, (float) iterator.next());
82 list.set(0, 1F); 82 list.set(0, 1F);
83 assertEquals(2F, (float) iterator.next()); 83 assertEquals(2F, (float) iterator.next());
84 84
85 list.remove(0); 85 list.remove(0);
86 try { 86 try {
87 iterator.next(); 87 iterator.next();
88 fail(); 88 fail();
89 } catch (ConcurrentModificationException e) { 89 } catch (ConcurrentModificationException e) {
90 // expected 90 // expected
91 } 91 }
92 92
93 iterator = list.iterator(); 93 iterator = list.iterator();
94 list.add(0, 0F); 94 list.add(0, 0F);
95 try { 95 try {
96 iterator.next(); 96 iterator.next();
97 fail(); 97 fail();
98 } catch (ConcurrentModificationException e) { 98 } catch (ConcurrentModificationException e) {
99 // expected 99 // expected
100 } 100 }
101 } 101 }
102 102
103 public void testGet() { 103 public void testGet() {
104 assertEquals(1F, (float) TERTIARY_LIST.get(0)); 104 assertEquals(1F, (float) TERTIARY_LIST.get(0));
105 assertEquals(2F, (float) TERTIARY_LIST.get(1)); 105 assertEquals(2F, (float) TERTIARY_LIST.get(1));
106 assertEquals(3F, (float) TERTIARY_LIST.get(2)); 106 assertEquals(3F, (float) TERTIARY_LIST.get(2));
107 107
108 try { 108 try {
109 TERTIARY_LIST.get(-1); 109 TERTIARY_LIST.get(-1);
110 fail(); 110 fail();
111 } catch (IndexOutOfBoundsException e) { 111 } catch (IndexOutOfBoundsException e) {
112 // expected 112 // expected
113 } 113 }
114 114
115 try { 115 try {
116 TERTIARY_LIST.get(3); 116 TERTIARY_LIST.get(3);
117 fail(); 117 fail();
118 } catch (IndexOutOfBoundsException e) { 118 } catch (IndexOutOfBoundsException e) {
119 // expected 119 // expected
120 } 120 }
121 } 121 }
122 122
123 public void testGetFloat() { 123 public void testGetFloat() {
124 assertEquals(1F, TERTIARY_LIST.getFloat(0)); 124 assertEquals(1F, TERTIARY_LIST.getFloat(0));
125 assertEquals(2F, TERTIARY_LIST.getFloat(1)); 125 assertEquals(2F, TERTIARY_LIST.getFloat(1));
126 assertEquals(3F, TERTIARY_LIST.getFloat(2)); 126 assertEquals(3F, TERTIARY_LIST.getFloat(2));
127 127
128 try { 128 try {
129 TERTIARY_LIST.get(-1); 129 TERTIARY_LIST.get(-1);
130 fail(); 130 fail();
131 } catch (IndexOutOfBoundsException e) { 131 } catch (IndexOutOfBoundsException e) {
132 // expected 132 // expected
133 } 133 }
134 134
135 try { 135 try {
136 TERTIARY_LIST.get(3); 136 TERTIARY_LIST.get(3);
137 fail(); 137 fail();
138 } catch (IndexOutOfBoundsException e) { 138 } catch (IndexOutOfBoundsException e) {
139 // expected 139 // expected
140 } 140 }
141 } 141 }
142 142
143 public void testSize() { 143 public void testSize() {
144 assertEquals(0, FloatArrayList.emptyList().size()); 144 assertEquals(0, FloatArrayList.emptyList().size());
145 assertEquals(1, UNARY_LIST.size()); 145 assertEquals(1, UNARY_LIST.size());
146 assertEquals(3, TERTIARY_LIST.size()); 146 assertEquals(3, TERTIARY_LIST.size());
147 147
148 list.addFloat(2); 148 list.addFloat(3);
149 list.addFloat(4); 149 list.addFloat(4);
150 list.addFloat(6); 150 list.addFloat(6);
151 list.addFloat(8); 151 list.addFloat(8);
152 assertEquals(4, list.size()); 152 assertEquals(4, list.size());
153 153
154 list.remove(0); 154 list.remove(0);
155 assertEquals(3, list.size()); 155 assertEquals(3, list.size());
156 156
157 list.add(16F); 157 list.add(17F);
158 assertEquals(4, list.size()); 158 assertEquals(4, list.size());
159 } 159 }
160 160
161 public void testSet() { 161 public void testSet() {
162 list.addFloat(2); 162 list.addFloat(2);
163 list.addFloat(4); 163 list.addFloat(4);
164 164
165 assertEquals(2F, (float) list.set(0, 0F)); 165 assertEquals(2F, (float) list.set(0, 3F));
166 assertEquals(0F, list.getFloat(0)); 166 assertEquals(3F, list.getFloat(0));
167 167
168 assertEquals(4F, (float) list.set(1, 0F)); 168 assertEquals(4F, (float) list.set(1, 0F));
169 assertEquals(0F, list.getFloat(1)); 169 assertEquals(0F, list.getFloat(1));
170 170
171 try { 171 try {
172 list.set(-1, 0F); 172 list.set(-1, 0F);
173 fail(); 173 fail();
174 } catch (IndexOutOfBoundsException e) { 174 } catch (IndexOutOfBoundsException e) {
175 // expected 175 // expected
176 } 176 }
177 177
178 try { 178 try {
179 list.set(2, 0F); 179 list.set(2, 0F);
180 fail(); 180 fail();
181 } catch (IndexOutOfBoundsException e) { 181 } catch (IndexOutOfBoundsException e) {
182 // expected 182 // expected
183 } 183 }
184 } 184 }
185 185
186 public void testSetFloat() { 186 public void testSetFloat() {
187 list.addFloat(2); 187 list.addFloat(1);
188 list.addFloat(4); 188 list.addFloat(3);
189 189
190 assertEquals(2F, list.setFloat(0, 0)); 190 assertEquals(1F, list.setFloat(0, 0));
191 assertEquals(0F, list.getFloat(0)); 191 assertEquals(0F, list.getFloat(0));
192 192
193 assertEquals(4F, list.setFloat(1, 0)); 193 assertEquals(3F, list.setFloat(1, 0));
194 assertEquals(0F, list.getFloat(1)); 194 assertEquals(0F, list.getFloat(1));
195 195
196 try { 196 try {
197 list.setFloat(-1, 0); 197 list.setFloat(-1, 0);
198 fail(); 198 fail();
199 } catch (IndexOutOfBoundsException e) { 199 } catch (IndexOutOfBoundsException e) {
200 // expected 200 // expected
201 } 201 }
202 202
203 try { 203 try {
204 list.setFloat(2, 0); 204 list.setFloat(2, 0);
205 fail(); 205 fail();
206 } catch (IndexOutOfBoundsException e) { 206 } catch (IndexOutOfBoundsException e) {
207 // expected 207 // expected
208 } 208 }
209 } 209 }
210 210
211 public void testAdd() { 211 public void testAdd() {
212 assertEquals(0, list.size()); 212 assertEquals(0, list.size());
213 213
214 assertTrue(list.add(2F)); 214 assertTrue(list.add(2F));
215 assertEquals(asList(2F), list); 215 assertEquals(asList(2F), list);
216 216
217 assertTrue(list.add(3F)); 217 assertTrue(list.add(3F));
218 list.add(0, 4F); 218 list.add(0, 4F);
219 assertEquals(asList(4F, 2F, 3F), list); 219 assertEquals(asList(4F, 2F, 3F), list);
220 220
221 list.add(0, 1F); 221 list.add(0, 1F);
222 list.add(0, 0F); 222 list.add(0, 0F);
223 // Force a resize by getting up to 11 elements. 223 // Force a resize by getting up to 11 elements.
224 for (int i = 0; i < 6; i++) { 224 for (int i = 0; i < 6; i++) {
225 list.add(Float.valueOf(5 + i)); 225 list.add(Float.valueOf(5 + i));
226 } 226 }
227 assertEquals(asList(0F, 1F, 4F, 2F, 3F, 5F, 6F, 7F, 8F, 9F, 10F), list); 227 assertEquals(
228 228 asList(0F, 1F, 4F, 2F, 3F, 5F, 6F, 7F, 8F, 9F, 10F),
229 list);
230
229 try { 231 try {
230 list.add(-1, 5F); 232 list.add(-1, 5F);
231 } catch (IndexOutOfBoundsException e) { 233 } catch (IndexOutOfBoundsException e) {
232 // expected 234 // expected
233 } 235 }
234 236
235 try { 237 try {
236 list.add(4, 5F); 238 list.add(4, 5F);
237 } catch (IndexOutOfBoundsException e) { 239 } catch (IndexOutOfBoundsException e) {
238 // expected 240 // expected
239 } 241 }
240 } 242 }
241 243
242 public void testAddFloat() { 244 public void testAddFloat() {
243 assertEquals(0, list.size()); 245 assertEquals(0, list.size());
244 246
245 list.addFloat(2); 247 list.addFloat(2);
246 assertEquals(asList(2F), list); 248 assertEquals(asList(2F), list);
247 249
248 list.addFloat(3); 250 list.addFloat(3);
249 assertEquals(asList(2F, 3F), list); 251 assertEquals(asList(2F, 3F), list);
250 } 252 }
251 253
252 public void testAddAll() { 254 public void testAddAll() {
253 assertEquals(0, list.size()); 255 assertEquals(0, list.size());
254 256
255 assertTrue(list.addAll(Collections.singleton(1F))); 257 assertTrue(list.addAll(Collections.singleton(1F)));
256 assertEquals(1, list.size()); 258 assertEquals(1, list.size());
257 assertEquals(1F, (float) list.get(0)); 259 assertEquals(1F, (float) list.get(0));
258 assertEquals(1F, list.getFloat(0)); 260 assertEquals(1F, list.getFloat(0));
259 261
260 assertTrue(list.addAll(asList(2F, 3F, 4F, 5F, 6F))); 262 assertTrue(list.addAll(asList(2F, 3F, 4F, 5F, 6F)));
261 assertEquals(asList(1F, 2F, 3F, 4F, 5F, 6F), list); 263 assertEquals(asList(1F, 2F, 3F, 4F, 5F, 6F), list);
262 264
263 assertTrue(list.addAll(TERTIARY_LIST)); 265 assertTrue(list.addAll(TERTIARY_LIST));
264 assertEquals(asList(1F, 2F, 3F, 4F, 5F, 6F, 1F, 2F, 3F), list); 266 assertEquals(asList(1F, 2F, 3F, 4F, 5F, 6F, 1F, 2F, 3F), list);
265 267
266 assertFalse(list.addAll(Collections.<Float>emptyList())); 268 assertFalse(list.addAll(Collections.<Float>emptyList()));
267 assertFalse(list.addAll(FloatArrayList.emptyList())); 269 assertFalse(list.addAll(FloatArrayList.emptyList()));
268 } 270 }
269 271
270 public void testRemove() { 272 public void testRemove() {
271 list.addAll(TERTIARY_LIST); 273 list.addAll(TERTIARY_LIST);
272 assertEquals(1F, (float) list.remove(0)); 274 assertEquals(1F, (float) list.remove(0));
273 assertEquals(asList(2F, 3F), list); 275 assertEquals(asList(2F, 3F), list);
274 276
275 assertTrue(list.remove(Float.valueOf(3))); 277 assertTrue(list.remove(Float.valueOf(3)));
276 assertEquals(asList(2F), list); 278 assertEquals(asList(2F), list);
277 279
278 assertFalse(list.remove(Float.valueOf(3))); 280 assertFalse(list.remove(Float.valueOf(3)));
279 assertEquals(asList(2F), list); 281 assertEquals(asList(2F), list);
280 282
281 assertEquals(2F, (float) list.remove(0)); 283 assertEquals(2F, (float) list.remove(0));
282 assertEquals(asList(), list); 284 assertEquals(asList(), list);
283 285
284 try { 286 try {
285 list.remove(-1); 287 list.remove(-1);
286 fail(); 288 fail();
287 } catch (IndexOutOfBoundsException e) { 289 } catch (IndexOutOfBoundsException e) {
288 // expected 290 // expected
289 } 291 }
290 292
291 try { 293 try {
292 list.remove(0); 294 list.remove(0);
293 } catch (IndexOutOfBoundsException e) { 295 } catch (IndexOutOfBoundsException e) {
294 // expected 296 // expected
295 } 297 }
296 } 298 }
297 299
298 private void assertImmutable(FloatArrayList list) { 300 private void assertImmutable(FloatArrayList list) {
299 if (list.contains(1F)) { 301 if (list.contains(1F)) {
300 throw new RuntimeException("Cannot test the immutability of lists that con tain 1."); 302 throw new RuntimeException("Cannot test the immutability of lists that con tain 1.");
301 } 303 }
302 304
303 try { 305 try {
304 list.add(1F); 306 list.add(1F);
305 fail(); 307 fail();
306 } catch (UnsupportedOperationException e) { 308 } catch (UnsupportedOperationException e) {
307 // expected 309 // expected
308 } 310 }
309 311
310 try { 312 try {
311 list.add(0, 1F); 313 list.add(0, 1F);
312 fail(); 314 fail();
313 } catch (UnsupportedOperationException e) { 315 } catch (UnsupportedOperationException e) {
314 // expected 316 // expected
315 } 317 }
316 318
317 try { 319 try {
318 list.addAll(Collections.<Float>emptyList()); 320 list.addAll(Collections.<Float>emptyList());
319 fail(); 321 fail();
320 } catch (UnsupportedOperationException e) { 322 } catch (UnsupportedOperationException e) {
321 // expected 323 // expected
322 } 324 }
323 325
324 try { 326 try {
325 list.addAll(Collections.singletonList(1F)); 327 list.addAll(Collections.singletonList(1F));
326 fail(); 328 fail();
327 } catch (UnsupportedOperationException e) { 329 } catch (UnsupportedOperationException e) {
328 // expected 330 // expected
329 } 331 }
330 332
331 try { 333 try {
332 list.addAll(new FloatArrayList()); 334 list.addAll(new FloatArrayList());
333 fail(); 335 fail();
334 } catch (UnsupportedOperationException e) { 336 } catch (UnsupportedOperationException e) {
335 // expected 337 // expected
336 } 338 }
337 339
338 try { 340 try {
339 list.addAll(UNARY_LIST); 341 list.addAll(UNARY_LIST);
340 fail(); 342 fail();
341 } catch (UnsupportedOperationException e) { 343 } catch (UnsupportedOperationException e) {
342 // expected 344 // expected
343 } 345 }
344 346
345 try { 347 try {
346 list.addAll(0, Collections.singleton(1F)); 348 list.addAll(0, Collections.singleton(1F));
347 fail(); 349 fail();
348 } catch (UnsupportedOperationException e) { 350 } catch (UnsupportedOperationException e) {
349 // expected 351 // expected
350 } 352 }
351 353
352 try { 354 try {
353 list.addAll(0, UNARY_LIST); 355 list.addAll(0, UNARY_LIST);
354 fail(); 356 fail();
355 } catch (UnsupportedOperationException e) { 357 } catch (UnsupportedOperationException e) {
356 // expected 358 // expected
357 } 359 }
358 360
359 try { 361 try {
360 list.addAll(0, Collections.<Float>emptyList()); 362 list.addAll(0, Collections.<Float>emptyList());
361 fail(); 363 fail();
362 } catch (UnsupportedOperationException e) { 364 } catch (UnsupportedOperationException e) {
363 // expected 365 // expected
364 } 366 }
365 367
366 try { 368 try {
367 list.addFloat(0); 369 list.addFloat(0);
368 fail(); 370 fail();
369 } catch (UnsupportedOperationException e) { 371 } catch (UnsupportedOperationException e) {
370 // expected 372 // expected
371 } 373 }
372 374
373 try { 375 try {
374 list.clear(); 376 list.clear();
375 fail(); 377 fail();
376 } catch (UnsupportedOperationException e) { 378 } catch (UnsupportedOperationException e) {
377 // expected 379 // expected
378 } 380 }
379 381
380 try { 382 try {
381 list.remove(1); 383 list.remove(1);
382 fail(); 384 fail();
383 } catch (UnsupportedOperationException e) { 385 } catch (UnsupportedOperationException e) {
384 // expected 386 // expected
385 } 387 }
386 388
387 try { 389 try {
388 list.remove(new Object()); 390 list.remove(new Object());
389 fail(); 391 fail();
390 } catch (UnsupportedOperationException e) { 392 } catch (UnsupportedOperationException e) {
391 // expected 393 // expected
392 } 394 }
393 395
394 try { 396 try {
395 list.removeAll(Collections.<Float>emptyList()); 397 list.removeAll(Collections.<Float>emptyList());
396 fail(); 398 fail();
397 } catch (UnsupportedOperationException e) { 399 } catch (UnsupportedOperationException e) {
398 // expected 400 // expected
399 } 401 }
400 402
401 try { 403 try {
402 list.removeAll(Collections.singleton(1F)); 404 list.removeAll(Collections.singleton(1F));
403 fail(); 405 fail();
404 } catch (UnsupportedOperationException e) { 406 } catch (UnsupportedOperationException e) {
405 // expected 407 // expected
406 } 408 }
407 409
408 try { 410 try {
409 list.removeAll(UNARY_LIST); 411 list.removeAll(UNARY_LIST);
410 fail(); 412 fail();
411 } catch (UnsupportedOperationException e) { 413 } catch (UnsupportedOperationException e) {
412 // expected 414 // expected
413 } 415 }
414 416
415 try { 417 try {
416 list.retainAll(Collections.<Float>emptyList()); 418 list.retainAll(Collections.<Float>emptyList());
417 fail(); 419 fail();
418 } catch (UnsupportedOperationException e) { 420 } catch (UnsupportedOperationException e) {
419 // expected 421 // expected
420 } 422 }
421 423
422 try { 424 try {
423 list.retainAll(Collections.singleton(1F)); 425 list.retainAll(Collections.singleton(1F));
424 fail(); 426 fail();
425 } catch (UnsupportedOperationException e) { 427 } catch (UnsupportedOperationException e) {
426 // expected 428 // expected
427 } 429 }
428 430
429 try { 431 try {
430 list.retainAll(UNARY_LIST); 432 list.retainAll(UNARY_LIST);
431 fail(); 433 fail();
432 } catch (UnsupportedOperationException e) { 434 } catch (UnsupportedOperationException e) {
433 // expected 435 // expected
434 } 436 }
435 437
436 try { 438 try {
437 list.set(0, 0F); 439 list.set(0, 0F);
438 fail(); 440 fail();
439 } catch (UnsupportedOperationException e) { 441 } catch (UnsupportedOperationException e) {
440 // expected 442 // expected
441 } 443 }
442 444
443 try { 445 try {
444 list.setFloat(0, 0); 446 list.setFloat(0, 0);
445 fail(); 447 fail();
446 } catch (UnsupportedOperationException e) { 448 } catch (UnsupportedOperationException e) {
447 // expected 449 // expected
448 } 450 }
449 } 451 }
450 452
451 private static FloatArrayList newImmutableFloatArrayList(int... elements) { 453 private static FloatArrayList newImmutableFloatArrayList(float... elements) {
452 FloatArrayList list = new FloatArrayList(); 454 FloatArrayList list = new FloatArrayList();
453 for (int element : elements) { 455 for (float element : elements) {
454 list.addFloat(element); 456 list.addFloat(element);
455 } 457 }
456 list.makeImmutable(); 458 list.makeImmutable();
457 return list; 459 return list;
458 } 460 }
459 } 461 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698