protected final E[] createArray(int size) { return createArray(elementType, size); }
/** * Returns a current snapshot of this List's backing array that * is guaranteed not to change through further List manipulation. * Changes to this array may or may not be reflected in the list and * should be avoided. */ public final E[] getArray() { if( backingArray != null ) return backingArray; if( buffer == null ) { backingArray = createArray(0); } else { // Only keep the array or the buffer but never both at // the same time. 1) it saves space, 2) it keeps the rest // of the code safer. backingArray = buffer.toArray( createArray(buffer.size()) ); buffer = null; } return backingArray; }
protected final E[] createArray(int size) { return createArray(elementType, size); }
protected final E[] createArray(int size) { return createArray(elementType, size); }
/** * Returns a current snapshot of this List's backing array that * is guaranteed not to change through further List manipulation. * Changes to this array may or may not be reflected in the list and * should be avoided. */ public final E[] getArray() { if( backingArray != null ) return backingArray; if( buffer == null ) { backingArray = createArray(0); } else { // Only keep the array or the buffer but never both at // the same time. 1) it saves space, 2) it keeps the rest // of the code safer. backingArray = buffer.toArray( createArray(buffer.size()) ); buffer = null; } return backingArray; }
/** * Returns a current snapshot of this List's backing array that * is guaranteed not to change through further List manipulation. * Changes to this array may or may not be reflected in the list and * should be avoided. */ public final E[] getArray() { if( backingArray != null ) return backingArray; if( buffer == null ) { backingArray = createArray(0); } else { // Only keep the array or the buffer but never both at // the same time. 1) it saves space, 2) it keeps the rest // of the code safer. backingArray = buffer.toArray( createArray(buffer.size()) ); buffer = null; } return backingArray; }