diff --git a/engine/src/core/com/jme3/util/SafeArrayList.java b/engine/src/core/com/jme3/util/SafeArrayList.java index 7fe7e63fc..fda95aa3e 100644 --- a/engine/src/core/com/jme3/util/SafeArrayList.java +++ b/engine/src/core/com/jme3/util/SafeArrayList.java @@ -320,6 +320,25 @@ public class SafeArrayList implements List { 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 implements ListIterator { private E[] array; private int next;