Package ai.libs.jaicore.basic.sets
Class ListView<T>
- java.lang.Object
-
- ai.libs.jaicore.basic.sets.ListView<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
java.lang.Iterable<T>,java.util.Collection<T>,java.util.List<T>
public class ListView<T> extends java.lang.Object implements java.util.List<T>This class allows to get a casted view on the items of a list. For example, if you have a list Listl, it is not possible to cast l to List even if you know that all items are integers. You can then use List l2 = new ListView<>(l); to get a (read-only) list of integers with automated casts.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int arg0, T arg1)booleanadd(T arg0)booleanaddAll(int arg0, java.util.Collection<? extends T> arg1)booleanaddAll(java.util.Collection<? extends T> arg0)voidclear()booleancontains(java.lang.Object arg0)booleancontainsAll(java.util.Collection<?> arg0)Tget(int arg0)intindexOf(java.lang.Object arg0)booleanisEmpty()java.util.Iterator<T>iterator()intlastIndexOf(java.lang.Object arg0)java.util.ListIterator<T>listIterator()java.util.ListIterator<T>listIterator(int arg0)Tremove(int arg0)booleanremove(java.lang.Object arg0)booleanremoveAll(java.util.Collection<?> arg0)booleanretainAll(java.util.Collection<?> arg0)Tset(int arg0, T arg1)intsize()java.util.List<T>subList(int arg0, int arg1)java.lang.Object[]toArray()<S> S[]toArray(S[] arg0)
-
-
-
Constructor Detail
-
ListView
public ListView(java.util.List<?> list)
-
ListView
public ListView(java.util.List<?> list, java.lang.Class<T> clazz)
-
-
Method Detail
-
add
public boolean add(T arg0)
-
addAll
public boolean addAll(java.util.Collection<? extends T> arg0)
-
addAll
public boolean addAll(int arg0, java.util.Collection<? extends T> arg1)- Specified by:
addAllin interfacejava.util.List<T>
-
clear
public void clear()
-
contains
public boolean contains(java.lang.Object arg0)
-
containsAll
public boolean containsAll(java.util.Collection<?> arg0)
-
indexOf
public int indexOf(java.lang.Object arg0)
- Specified by:
indexOfin interfacejava.util.List<T>
-
isEmpty
public boolean isEmpty()
-
iterator
public java.util.Iterator<T> iterator()
-
lastIndexOf
public int lastIndexOf(java.lang.Object arg0)
- Specified by:
lastIndexOfin interfacejava.util.List<T>
-
listIterator
public java.util.ListIterator<T> listIterator()
- Specified by:
listIteratorin interfacejava.util.List<T>
-
listIterator
public java.util.ListIterator<T> listIterator(int arg0)
- Specified by:
listIteratorin interfacejava.util.List<T>
-
remove
public boolean remove(java.lang.Object arg0)
-
removeAll
public boolean removeAll(java.util.Collection<?> arg0)
-
retainAll
public boolean retainAll(java.util.Collection<?> arg0)
-
size
public int size()
-
subList
public java.util.List<T> subList(int arg0, int arg1)
- Specified by:
subListin interfacejava.util.List<T>
-
toArray
public java.lang.Object[] toArray()
-
-