Main repository of MikuMikuStudio
Révision | 4ec4f2994a9482a8ebd904b19df10b9c057b9640 (tree) |
---|---|
l'heure | 2013-07-07 00:17:39 |
Auteur | kobayasi <kobayasi@pscn...> |
Commiter | kobayasi |
update SafeArrayList
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* |
2 | - * Copyright (c) 2009-2011 jMonkeyEngine | |
2 | + * Copyright (c) 2009-2012 jMonkeyEngine | |
3 | 3 | * All rights reserved. |
4 | 4 | * |
5 | 5 | * Redistribution and use in source and binary forms, with or without |
@@ -29,7 +29,6 @@ | ||
29 | 29 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
30 | 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 | 31 | */ |
32 | - | |
33 | 32 | package com.jme3.util; |
34 | 33 | |
35 | 34 | import java.util.*; |
@@ -66,7 +65,7 @@ import java.util.*; | ||
66 | 65 | * original snapshot. |
67 | 66 | * </ul> |
68 | 67 | * |
69 | - * @version $Revision: 7856 $ | |
68 | + * @version $Revision$ | |
70 | 69 | * @author Paul Speed |
71 | 70 | */ |
72 | 71 | public class SafeArrayList<E> implements List<E> { |
@@ -320,6 +319,25 @@ public class SafeArrayList<E> implements List<E> { | ||
320 | 319 | return Collections.unmodifiableList(raw); |
321 | 320 | } |
322 | 321 | |
322 | + public String toString() { | |
323 | + | |
324 | + E[] array = getArray(); | |
325 | + if( array.length == 0 ) { | |
326 | + return "[]"; | |
327 | + } | |
328 | + | |
329 | + StringBuilder sb = new StringBuilder(); | |
330 | + sb.append('['); | |
331 | + for( int i = 0; i < array.length; i++ ) { | |
332 | + if( i > 0 ) | |
333 | + sb.append( ", " ); | |
334 | + E e = array[i]; | |
335 | + sb.append( e == this ? "(this Collection)" : e ); | |
336 | + } | |
337 | + sb.append(']'); | |
338 | + return sb.toString(); | |
339 | + } | |
340 | + | |
323 | 341 | protected class ArrayIterator<E> implements ListIterator<E> { |
324 | 342 | private E[] array; |
325 | 343 | private int next; |