Package org.jboss.weld.util.collections
Class ListView<SOURCE,VIEW>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<VIEW>
-
- org.jboss.weld.util.collections.ListView<SOURCE,VIEW>
-
- Type Parameters:
SOURCE- the source typeVIEW- the view type
- All Implemented Interfaces:
Iterable<VIEW>,Collection<VIEW>,List<VIEW>
public abstract class ListView<SOURCE,VIEW> extends AbstractList<VIEW>
Provides a view of type Listfor a List . Changes to the view list are reflected within the source list and vice versa. - Author:
- Jozef Hartinger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classListView.ListViewIterator
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description ListView()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(int index, VIEW element)booleanadd(VIEW element)voidclear()protected abstract SOURCEcreateSource(VIEW view)Creates a new source object based on a given view.VIEWget(int index)protected abstract List<SOURCE>getDelegate()Iterator<VIEW>iterator()ListIterator<VIEW>listIterator()ListIterator<VIEW>listIterator(int index)VIEWremove(int index)VIEWset(int index, VIEW element)intsize()protected abstract VIEWtoView(SOURCE source)Provides a view representation of a source object.-
Methods inherited from class java.util.AbstractList
addAll, equals, hashCode, indexOf, lastIndexOf, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
get
public VIEW get(int index)
-
size
public int size()
- Specified by:
sizein interfaceCollection<SOURCE>- Specified by:
sizein interfaceList<SOURCE>- Specified by:
sizein classAbstractCollection<VIEW>
-
add
public boolean add(VIEW element)
- Specified by:
addin interfaceCollection<SOURCE>- Specified by:
addin interfaceList<SOURCE>- Overrides:
addin classAbstractList<VIEW>
-
add
public void add(int index, VIEW element)
-
remove
public VIEW remove(int index)
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<SOURCE>- Specified by:
clearin interfaceList<SOURCE>- Overrides:
clearin classAbstractList<VIEW>
-
listIterator
public ListIterator<VIEW> listIterator()
- Specified by:
listIteratorin interfaceList<SOURCE>- Overrides:
listIteratorin classAbstractList<VIEW>
-
listIterator
public ListIterator<VIEW> listIterator(int index)
- Specified by:
listIteratorin interfaceList<SOURCE>- Overrides:
listIteratorin classAbstractList<VIEW>
-
toView
protected abstract VIEW toView(SOURCE source)
Provides a view representation of a source object.- Parameters:
source-- Returns:
- a view representation
-
-