package org.eclipse.collections.impl.list.mutable.primitive;
import java.util.Collection;
import java.util.Comparator;
import java.util.Random;
import org.eclipse.collections.api.ShortIterable;
import org.eclipse.collections.api.LazyShortIterable;
import org.eclipse.collections.api.block.comparator.primitive.ShortComparator;
import org.eclipse.collections.api.block.function.primitive.ShortIntToObjectFunction;
import org.eclipse.collections.api.block.function.primitive.ShortToObjectFunction;
import org.eclipse.collections.api.block.function.primitive.ObjectShortIntToObjectFunction;
import org.eclipse.collections.api.block.predicate.primitive.ShortPredicate;
import org.eclipse.collections.api.block.procedure.primitive.ShortIntProcedure;
import org.eclipse.collections.api.list.MutableList;
import org.eclipse.collections.api.list.primitive.ShortList;
import org.eclipse.collections.api.list.primitive.ImmutableShortList;
import org.eclipse.collections.api.list.primitive.MutableShortList;
import org.eclipse.collections.api.tuple.primitive.ShortShortPair;
import org.eclipse.collections.api.tuple.primitive.ShortObjectPair;
import org.eclipse.collections.impl.collection.mutable.primitive.AbstractSynchronizedShortCollection;
import org.eclipse.collections.impl.factory.primitive.ShortLists;
import org.eclipse.collections.impl.lazy.primitive.LazyShortIterableAdapter;
import org.eclipse.collections.impl.lazy.primitive.ReverseShortIterable;
public class SynchronizedShortList
extends AbstractSynchronizedShortCollection
implements MutableShortList
{
private static final long serialVersionUID = 1L;
public SynchronizedShortList(MutableShortList list)
{
super(list);
}
public SynchronizedShortList(MutableShortList list, Object newLock)
{
super(list, newLock);
}
private MutableShortList getMutableShortList()
{
return (MutableShortList) this.getShortCollection();
}
@Override
public short get(int index)
{
synchronized (this.getLock())
{
return this.getMutableShortList().get(index);
}
}
@Override
public short getFirst()
{
synchronized (this.getLock())
{
return this.getMutableShortList().getFirst();
}
}
@Override
public short getLast()
{
synchronized (this.getLock())
{
return this.getMutableShortList().getLast();
}
}
@Override
public int indexOf(short value)
{
synchronized (this.getLock())
{
return this.getMutableShortList().indexOf(value);
}
}
@Override
public int lastIndexOf(short value)
{
synchronized (this.getLock())
{
return this.getMutableShortList().lastIndexOf(value);
}
}
@Override
public void addAtIndex(int index, short element)
{
synchronized (this.getLock())
{
this.getMutableShortList().addAtIndex(index, element);
}
}
@Override
public boolean addAllAtIndex(int index, short... source)
{
synchronized (this.getLock())
{
return this.getMutableShortList().addAllAtIndex(index, source);
}
}
@Override
public boolean addAllAtIndex(int index, ShortIterable source)
{
synchronized (this.getLock())
{
return this.getMutableShortList().addAllAtIndex(index, source);
}
}
@Override
public short removeAtIndex(int index)
{
synchronized (this.getLock())
{
return this.getMutableShortList().removeAtIndex(index);
}
}
@Override
public short set(int index, short element)
{
synchronized (this.getLock())
{
return this.getMutableShortList().set(index, element);
}
}
@Override
public SynchronizedShortList with(short element)
{
synchronized (this.getLock())
{
this.getMutableShortList().add(element);
}
return this;
}
@Override
public SynchronizedShortList without(short element)
{
synchronized (this.getLock())
{
this.getMutableShortList().remove(element);
}
return this;
}
@Override
public SynchronizedShortList withAll(ShortIterable elements)
{
synchronized (this.getLock())
{
this.getMutableShortList().addAll(elements.toArray());
}
return this;
}
@Override
public SynchronizedShortList withoutAll(ShortIterable elements)
{
synchronized (this.getLock())
{
this.getMutableShortList().removeAll(elements);
}
return this;
}
@Override
public MutableShortList select(ShortPredicate predicate)
{
synchronized (this.getLock())
{
return this.getMutableShortList().select(predicate);
}
}
@Override
public MutableShortList reject(ShortPredicate predicate)
{
synchronized (this.getLock())
{
return this.getMutableShortList().reject(predicate);
}
}
@Override
public <V> MutableList<V> collect(ShortToObjectFunction<? extends V> function)
{
synchronized (this.getLock())
{
return this.getMutableShortList().collect(function);
}
}
@Override
public MutableShortList sortThis()
{
synchronized (this.getLock())
{
this.getMutableShortList().sortThis();
}
return this;
}
@Override
public MutableShortList sortThis(ShortComparator comparator)
{
synchronized (this.getLock())
{
this.getMutableShortList().sortThis(comparator);
}
return this;
}
@Override
public <T> MutableShortList sortThisBy(ShortToObjectFunction<T> function)
{
synchronized (this.getLock())
{
this.getMutableShortList().sortThisBy(function);
}
return this;
}
@Override
public <T> MutableShortList sortThisBy(ShortToObjectFunction<T> function, Comparator<? super T> comparator)
{
synchronized (this.getLock())
{
this.getMutableShortList().sortThisBy(function, comparator);
}
return this;
}
@Override
public MutableShortList shuffleThis()
{
synchronized (this.getLock())
{
this.getMutableShortList().shuffleThis();
}
return this;
}
@Override
public MutableShortList shuffleThis(Random rnd)
{
synchronized (this.getLock())
{
this.getMutableShortList().shuffleThis(rnd);
}
return this;
}
@Override
public int binarySearch(short value)
{
synchronized (this.getLock())
{
return this.getMutableShortList().binarySearch(value);
}
}
@Override
public long dotProduct(ShortList list)
{
synchronized (this.getLock())
{
return this.getMutableShortList().dotProduct(list);
}
}
@Override
public boolean equals(Object otherList)
{
synchronized (this.getLock())
{
return this.getMutableShortList().equals(otherList);
}
}
@Override
public int hashCode()
{
synchronized (this.getLock())
{
return this.getMutableShortList().hashCode();
}
}
@Override
public LazyShortIterable asLazy()
{
synchronized (this.getLock())
{
return new LazyShortIterableAdapter(this);
}
}
@Override
public MutableShortList asUnmodifiable()
{
synchronized (this.getLock())
{
return new UnmodifiableShortList(this);
}
}
@Override
public MutableShortList asSynchronized()
{
return this;
}
@Override
public ImmutableShortList toImmutable()
{
synchronized (this.getLock())
{
int size = this.size();
if (size == 0)
{
return ShortLists.immutable.with();
}
if (size == 1)
{
return ShortLists.immutable.with(this.getFirst());
}
return ShortLists.immutable.with(this.toArray());
}
}
public MutableShortList newEmpty()
{
synchronized (this.getLock())
{
return this.getMutableShortList().newEmpty();
}
}
@Override
public MutableShortList reverseThis()
{
synchronized (this.getLock())
{
this.getMutableShortList().reverseThis();
}
return this;
}
@Override
public MutableShortList toReversed()
{
synchronized (this.getLock())
{
return this.getMutableShortList().toReversed();
}
}
@Override
public LazyShortIterable asReversed()
{
return ReverseShortIterable.adapt(this);
}
@Override
public void forEachWithIndex(ShortIntProcedure procedure)
{
synchronized (this.getLock())
{
this.getMutableShortList().forEachWithIndex(procedure);
}
}
@Override
public <T> T injectIntoWithIndex(T injectedValue, ObjectShortIntToObjectFunction<? super T, ? extends T> function)
{
synchronized (this.getLock())
{
return this.getMutableShortList().injectIntoWithIndex(injectedValue, function);
}
}
@Override
public MutableShortList distinct()
{
synchronized (this.getLock())
{
return this.getMutableShortList().distinct();
}
}
@Override
public MutableShortList subList(int fromIndex, int toIndex)
{
throw new UnsupportedOperationException("subList not yet implemented!");
}
public MutableList<ShortShortPair> zipShort(ShortIterable iterable)
{
synchronized (this.getLock())
{
return this.getMutableShortList().zipShort(iterable);
}
}
public <T> MutableList<ShortObjectPair<T>> zip(Iterable<T> iterable)
{
synchronized (this.getLock())
{
return this.getMutableShortList().zip(iterable);
}
}
@Override
public <V> MutableList<V> collectWithIndex(ShortIntToObjectFunction<? extends V> function)
{
synchronized (this.getLock())
{
return this.getMutableShortList().collectWithIndex(function);
}
}
public <V, R extends Collection<V>> R collectWithIndex(ShortIntToObjectFunction<? extends V> function, R target)
{
synchronized (this.getLock())
{
return this.getMutableShortList().collectWithIndex(function, target);
}
}
}