|
|
@ -320,6 +320,25 @@ public class SafeArrayList<E> implements List<E> { |
|
|
|
return Collections.unmodifiableList(raw); |
|
|
|
return Collections.unmodifiableList(raw); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String toString() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
E[] array = getArray(); |
|
|
|
|
|
|
|
if( array.length == 0 ) { |
|
|
|
|
|
|
|
return "[]"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
|
|
|
|
sb.append('['); |
|
|
|
|
|
|
|
for( int i = 0; i < array.length; i++ ) { |
|
|
|
|
|
|
|
if( i > 0 ) |
|
|
|
|
|
|
|
sb.append( ", " ); |
|
|
|
|
|
|
|
E e = array[i]; |
|
|
|
|
|
|
|
sb.append( e == this ? "(this Collection)" : e ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
sb.append(']'); |
|
|
|
|
|
|
|
return sb.toString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected class ArrayIterator<E> implements ListIterator<E> { |
|
|
|
protected class ArrayIterator<E> implements ListIterator<E> { |
|
|
|
private E[] array; |
|
|
|
private E[] array; |
|
|
|
private int next; |
|
|
|
private int next; |
|
|
|