
io.github.solf.extra2.collection.DelegateList Maven / Gradle / Ivy
/**
* Copyright Sergey Olefir
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.solf.extra2.collection;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.function.IntFunction;
import java.util.function.Predicate;
import java.util.function.UnaryOperator;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
/**
* Delegates all the operations to an underlying list.
*
* DOES NOT delegate equals/hashCode/toString methods.
*
* Exists because Lombok's @Delegate doesn't allow overriding some methods
* directly (so e.g. @Delegate can't be used directly in {@link WrapperBList}).
*
* The class is mostly auto-generated by Eclipse.
*
* @author Sergey Olefir
*/
@SuppressWarnings("unlikely-arg-type")
/*package*/ class DelegateList
{
/**
* Underlying list.
*/
@Nonnull
protected final List ulist;
/**
* Constructor.
*/
public DelegateList(@Nonnull List srcList)
{
this.ulist = srcList;
}
//
// EVERYTHING BELOW IS AUTO-GENERATED
//
/**
* @param action
* @see java.lang.Iterable#forEach(java.util.function.Consumer)
*/
public void forEach(Consumer super E> action)
{
ulist.forEach(action);
}
/**
* @return
* @see java.util.List#size()
*/
public int size()
{
return ulist.size();
}
/**
* @return
* @see java.util.List#isEmpty()
*/
public boolean isEmpty()
{
return ulist.isEmpty();
}
/**
* @param o
* @return
* @see java.util.List#contains(java.lang.Object)
*/
public boolean contains(Object o)
{
return ulist.contains(o);
}
/**
* @return
* @see java.util.List#iterator()
*/
public @Nonnull Iterator iterator()
{
return ulist.iterator();
}
/**
* @return
* @see java.util.List#toArray()
*/
public Object @Nonnull [] toArray()
{
return ulist.toArray();
}
/**
* @param
* @param a
* @return
* @see java.util.List#toArray(java.lang.Object[])
*/
public T @Nonnull [] toArray(T @Nonnull [] a)
{
return ulist.toArray(a);
}
/**
* @param e
* @return
* @see java.util.List#add(java.lang.Object)
*/
public boolean add(E e)
{
return ulist.add(e);
}
/**
* @param o
* @return
* @see java.util.List#remove(java.lang.Object)
*/
public boolean remove(Object o)
{
return ulist.remove(o);
}
/**
* @param c
* @return
* @see java.util.List#containsAll(java.util.Collection)
*/
public boolean containsAll(Collection> c)
{
return ulist.containsAll(c);
}
/**
* @param c
* @return
* @see java.util.List#addAll(java.util.Collection)
*/
public boolean addAll(@Nonnull Collection extends E> c)
{
return ulist.addAll(c);
}
/**
* @param index
* @param c
* @return
* @see java.util.List#addAll(int, java.util.Collection)
*/
public boolean addAll(int index, @Nonnull Collection extends E> c)
{
return ulist.addAll(index, c);
}
/**
* @param c
* @return
* @see java.util.List#removeAll(java.util.Collection)
*/
public boolean removeAll(Collection> c)
{
return ulist.removeAll(c);
}
/**
* @param
* @param generator
* @return
* @see java.util.Collection#toArray(java.util.function.IntFunction)
*/
public T[] toArray(IntFunction generator)
{
return ulist.toArray(generator);
}
/**
* @param c
* @return
* @see java.util.List#retainAll(java.util.Collection)
*/
public boolean retainAll(Collection> c)
{
return ulist.retainAll(c);
}
/**
* @param operator
* @see java.util.List#replaceAll(java.util.function.UnaryOperator)
*/
public void replaceAll(UnaryOperator operator)
{
ulist.replaceAll(operator);
}
/**
* @param c
* @see java.util.List#sort(java.util.Comparator)
*/
public void sort(Comparator super E> c)
{
ulist.sort(c);
}
/**
*
* @see java.util.List#clear()
*/
public void clear()
{
ulist.clear();
}
/**
* @param index
* @return
* @see java.util.List#get(int)
*/
public E get(int index)
{
return ulist.get(index);
}
/**
* @param filter
* @return
* @see java.util.Collection#removeIf(java.util.function.Predicate)
*/
public boolean removeIf(Predicate super E> filter)
{
return ulist.removeIf(filter);
}
/**
* @param index
* @param element
* @return
* @see java.util.List#set(int, java.lang.Object)
*/
public E set(int index, E element)
{
return ulist.set(index, element);
}
/**
* @param index
* @param element
* @see java.util.List#add(int, java.lang.Object)
*/
public void add(int index, E element)
{
ulist.add(index, element);
}
/**
* @param index
* @return
* @see java.util.List#remove(int)
*/
public E remove(int index)
{
return ulist.remove(index);
}
/**
* @param o
* @return
* @see java.util.List#indexOf(java.lang.Object)
*/
public int indexOf(Object o)
{
return ulist.indexOf(o);
}
/**
* @param o
* @return
* @see java.util.List#lastIndexOf(java.lang.Object)
*/
public int lastIndexOf(Object o)
{
return ulist.lastIndexOf(o);
}
/**
* @return
* @see java.util.List#listIterator()
*/
public ListIterator listIterator()
{
return ulist.listIterator();
}
/**
* @param index
* @return
* @see java.util.List#listIterator(int)
*/
public ListIterator listIterator(int index)
{
return ulist.listIterator(index);
}
/**
* @param fromIndex
* @param toIndex
* @return
* @see java.util.List#subList(int, int)
*/
public @Nonnull List subList(int fromIndex, int toIndex)
{
return ulist.subList(fromIndex, toIndex);
}
/**
* @return
* @see java.util.List#spliterator()
*/
public Spliterator spliterator()
{
return ulist.spliterator();
}
/**
* @return
* @see java.util.Collection#stream()
*/
public @Nonnull Stream stream()
{
return ulist.stream();
}
/**
* @return
* @see java.util.Collection#parallelStream()
*/
public Stream parallelStream()
{
return ulist.parallelStream();
}
}