java: public void trimToSize() {int s = size;if (s == array.length) {return;}if (s == 0) {array = EmptyArray.OBJECT;} else {Object[] newArray = new Object[s];System.arraycopy(array, 0, newArray, 0, s);array = newArray;}modCount++;}
C#: public virtual void trimToSize(){int s = _size;if (s == array.Length){return;}if (s == 0){array = libcore.util.EmptyArray.OBJECT;}else{object[] newArray = new object[s];System.Array.Copy(array, 0, newArray, 0, s);array = newArray;}modCount++;}