@Override @SuppressWarnings("unchecked") public void add(int index, Object value) { if ( index < 0 ) { throw new ArrayIndexOutOfBoundsException( "negative index" ); } write(); list.add( index, value ); }
@Override @SuppressWarnings("unchecked") public boolean addAll(int index, Collection coll) { if ( coll.size()>0 ) { write(); return list.addAll( index, coll ); } else { return false; } }
@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 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 @SuppressWarnings("unchecked") public boolean addAll(int index, Collection<? extends E> coll) { if ( coll.size()>0 ) { write(); return list.addAll( index, coll ); } else { return false; } }
/** * @see java.util.List#addAll(int, Collection) */ public boolean addAll(int index, Collection coll) { if ( coll.size()>0 ) { write(); return list.addAll(index, coll); } else { return false; } }
/** * @see java.util.List#addAll(int, Collection) */ public boolean addAll(int index, Collection coll) { if ( coll.size()>0 ) { write(); return list.addAll(index, coll); } else { return false; } }
@Override @SuppressWarnings("unchecked") public void add(int index, E value) { if ( index < 0 ) { throw new ArrayIndexOutOfBoundsException( "negative index" ); } write(); list.add( index, value ); }
@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; } }
@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; } }
@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; } }