Added a toString method similar to AbstractCollection's.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8940 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
PSp..om 13 years ago
parent 817591076e
commit 4c2ccc66e0
  1. 19
      engine/src/core/com/jme3/util/SafeArrayList.java

@ -320,6 +320,25 @@ public class SafeArrayList<E> implements List<E> {
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> {
private E[] array;
private int next;

Loading…
Cancel
Save