@Override @SuppressWarnings("unchecked") public boolean addAll(Collection values) { if ( values.size()==0 ) { return false; } if ( !isOperationQueueEnabled() ) { write(); return list.addAll( values ); } else { for ( Object value : values ) { queueOperation( new SimpleAdd( value ) ); } return values.size()>0; } }
@Override @SuppressWarnings("unchecked") public boolean add(Object object) { if ( !isOperationQueueEnabled() ) { write(); return list.add( object ); } else { queueOperation( new SimpleAdd( object ) ); return true; } }
@Override @SuppressWarnings("unchecked") public void clear() { if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! list.isEmpty() ) { list.clear(); dirty(); } } }
@Override @SuppressWarnings("unchecked") public Object set(int index, Object value) { if (index<0) { throw new ArrayIndexOutOfBoundsException("negative index"); } final Object old = isPutQueueEnabled() ? readElementByIndex( index ) : UNKNOWN; if ( old==UNKNOWN ) { write(); return list.set( index, value ); } else { queueOperation( new Set( index, value, old ) ); return old; } }
@Override @SuppressWarnings("unchecked") public Object remove(int index) { if ( index < 0 ) { throw new ArrayIndexOutOfBoundsException( "negative index" ); } final Object old = isPutQueueEnabled() ? readElementByIndex( index ) : UNKNOWN; elementRemoved = true; if ( old == UNKNOWN ) { write(); dirty(); return list.remove( index ); } else { queueOperation( new Remove( index, old ) ); return old; } }
@Override public boolean remove(Object value) { final Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null; if ( exists == null ) { initialize( true ); if ( list.remove( value ) ) { elementRemoved = true; dirty(); return true; } else { return false; } } else if ( exists ) { elementRemoved = true; queueOperation( new SimpleRemove( value ) ); return true; } else { return false; } }
@Override @SuppressWarnings("unchecked") public boolean addAll(Collection<? extends E> values) { if ( values.size()==0 ) { return false; } if ( !isOperationQueueEnabled() ) { write(); return list.addAll( values ); } else { values.forEach( e -> queueOperation( new SimpleAdd( e ) ) ); return values.size()>0; } }
/** * @see java.util.List#addAll(Collection) */ public boolean addAll(Collection values) { if ( values.size()==0 ) { return false; } if ( !isOperationQueueEnabled() ) { write(); return list.addAll(values); } else { Iterator iter = values.iterator(); while ( iter.hasNext() ) { queueOperation( new SimpleAdd( iter.next() ) ); } return values.size()>0; } }
@Override @SuppressWarnings("unchecked") public boolean add(E object) { if ( !isOperationQueueEnabled() ) { write(); return list.add( object ); } else { queueOperation( new SimpleAdd( object ) ); return true; } }
/** * @see java.util.List#add(int, Object) */ public void add(int index, Object value) { if (index<0) { throw new ArrayIndexOutOfBoundsException("negative index"); } if ( !isOperationQueueEnabled() ) { write(); list.add(index, value); } else { queueOperation( new Add(index, value) ); } }
/** * @see java.util.List#add(int, Object) */ public void add(int index, Object value) { if (index<0) { throw new ArrayIndexOutOfBoundsException("negative index"); } if ( !isOperationQueueEnabled() ) { write(); list.add(index, value); } else { queueOperation( new Add(index, value) ); } }
/** * @see java.util.List#add(Object) */ public boolean add(Object object) { if ( !isOperationQueueEnabled() ) { write(); return list.add(object); } else { queueOperation( new SimpleAdd(object) ); return true; } }
/** * @see java.util.List#add(Object) */ public boolean add(Object object) { if ( !isOperationQueueEnabled() ) { write(); return list.add(object); } else { queueOperation( new SimpleAdd(object) ); return true; } }
/** * @see java.util.List#clear() */ public void clear() { if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! list.isEmpty() ) { list.clear(); dirty(); } } }
/** * @see java.util.List#clear() */ public void clear() { if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! list.isEmpty() ) { list.clear(); dirty(); } } }
@Override @SuppressWarnings("unchecked") public void clear() { if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! list.isEmpty() ) { list.clear(); dirty(); } } }
@Override @SuppressWarnings("unchecked") public E set(int index, E value) { if (index<0) { throw new ArrayIndexOutOfBoundsException("negative index"); } final E old = isPutQueueEnabled() ? readElementByIndex( index ) : (E) UNKNOWN; if ( old==UNKNOWN ) { write(); return list.set( index, value ); } else { queueOperation( new Set( index, value, old ) ); return old; } }
/** * @see java.util.List#set(int, Object) */ public Object set(int index, Object value) { if (index<0) { throw new ArrayIndexOutOfBoundsException("negative index"); } Object old = isPutQueueEnabled() ? readElementByIndex( index ) : UNKNOWN; if ( old==UNKNOWN ) { write(); return list.set(index, value); } else { queueOperation( new Set(index, value, old) ); return old; } }
/** * @see java.util.List#set(int, Object) */ public Object set(int index, Object value) { if (index<0) { throw new ArrayIndexOutOfBoundsException("negative index"); } Object old = isPutQueueEnabled() ? readElementByIndex( index ) : UNKNOWN; if ( old==UNKNOWN ) { write(); return list.set(index, value); } else { queueOperation( new Set(index, value, old) ); return old; } }
/** * @see java.util.List#remove(int) */ public Object remove(int index) { if (index<0) { throw new ArrayIndexOutOfBoundsException("negative index"); } Object old = isPutQueueEnabled() ? readElementByIndex( index ) : UNKNOWN; if ( old==UNKNOWN ) { write(); return list.remove(index); } else { queueOperation( new Remove(index, old) ); return old; } }