Package org.opensaml.core.xml.util
Class ListView<ElementType extends XMLObject>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<ElementType>
-
- org.opensaml.core.xml.util.ListView<ElementType>
-
- Type Parameters:
ElementType
- the XMLObject type that this list operates on
- All Implemented Interfaces:
Iterable<ElementType>
,Collection<ElementType>
,List<ElementType>
class ListView<ElementType extends XMLObject> extends AbstractList<ElementType>
A special list that works as a view of an IndexedXMLObjectChildrenList showing only the sublist associated with a given index. Operations performed on this sublist are reflected in the backing list. Index-based mutation operations are not supported.
-
-
Field Summary
Fields Modifier and Type Field Description private IndexedXMLObjectChildrenList<ElementType>
backingList
List that backs this view.private QName
index
Index that points to the list, in the backing list, that this view operates on.private List<ElementType>
indexList
List, in the backing list, that the given index points to.-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description ListView(IndexedXMLObjectChildrenList<ElementType> newBackingList, QName newIndex)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int newIndex, ElementType element)
boolean
add(ElementType o)
boolean
addAll(int i, Collection<? extends ElementType> c)
boolean
addAll(Collection<? extends ElementType> c)
void
clear()
boolean
contains(Object element)
Checks to see if the given element is contained in this list.boolean
containsAll(Collection<?> c)
ElementType
get(int newIndex)
int
indexOf(Object o)
boolean
isEmpty()
int
lastIndexOf(Object o)
ElementType
remove(int newIndex)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
ElementType
set(int newIndex, ElementType element)
int
size()
Object[]
toArray()
<T> T[]
toArray(T[] a)
-
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
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
replaceAll, sort, spliterator
-
-
-
-
Field Detail
-
backingList
private final IndexedXMLObjectChildrenList<ElementType extends XMLObject> backingList
List that backs this view.
-
index
@Nonnull private final QName index
Index that points to the list, in the backing list, that this view operates on.
-
indexList
@Nonnull private List<ElementType extends XMLObject> indexList
List, in the backing list, that the given index points to.
-
-
Constructor Detail
-
ListView
public ListView(@Nonnull IndexedXMLObjectChildrenList<ElementType> newBackingList, @Nonnull QName newIndex)
Constructor.- Parameters:
newBackingList
- the list that backs this viewnewIndex
- the element schema type or name of the sublist this view operates on
-
-
Method Detail
-
add
public boolean add(@Nullable ElementType o)
- Specified by:
add
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
add
in interfaceList<ElementType extends XMLObject>
- Overrides:
add
in classAbstractList<ElementType extends XMLObject>
-
add
public void add(int newIndex, @Nullable ElementType element)
- Specified by:
add
in interfaceList<ElementType extends XMLObject>
- Overrides:
add
in classAbstractList<ElementType extends XMLObject>
-
addAll
public boolean addAll(@Nonnull Collection<? extends ElementType> c)
- Specified by:
addAll
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
addAll
in interfaceList<ElementType extends XMLObject>
- Overrides:
addAll
in classAbstractCollection<ElementType extends XMLObject>
-
addAll
public boolean addAll(int i, @Nonnull Collection<? extends ElementType> c)
- Specified by:
addAll
in interfaceList<ElementType extends XMLObject>
- Overrides:
addAll
in classAbstractList<ElementType extends XMLObject>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
clear
in interfaceList<ElementType extends XMLObject>
- Overrides:
clear
in classAbstractList<ElementType extends XMLObject>
-
contains
public boolean contains(Object element)
Checks to see if the given element is contained in this list.- Specified by:
contains
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
contains
in interfaceList<ElementType extends XMLObject>
- Overrides:
contains
in classAbstractCollection<ElementType extends XMLObject>
- Parameters:
element
- the element to check for- Returns:
- true if the element is in this list, false if not
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
containsAll
in interfaceList<ElementType extends XMLObject>
- Overrides:
containsAll
in classAbstractCollection<ElementType extends XMLObject>
-
get
public ElementType get(int newIndex)
- Specified by:
get
in interfaceList<ElementType extends XMLObject>
- Specified by:
get
in classAbstractList<ElementType extends XMLObject>
-
indexOf
public int indexOf(Object o)
- Specified by:
indexOf
in interfaceList<ElementType extends XMLObject>
- Overrides:
indexOf
in classAbstractList<ElementType extends XMLObject>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
isEmpty
in interfaceList<ElementType extends XMLObject>
- Overrides:
isEmpty
in classAbstractCollection<ElementType extends XMLObject>
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOf
in interfaceList<ElementType extends XMLObject>
- Overrides:
lastIndexOf
in classAbstractList<ElementType extends XMLObject>
-
remove
@Nonnull public ElementType remove(int newIndex)
- Specified by:
remove
in interfaceList<ElementType extends XMLObject>
- Overrides:
remove
in classAbstractList<ElementType extends XMLObject>
-
remove
public boolean remove(@Nullable Object o)
- Specified by:
remove
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
remove
in interfaceList<ElementType extends XMLObject>
- Overrides:
remove
in classAbstractCollection<ElementType extends XMLObject>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
removeAll
in interfaceList<ElementType extends XMLObject>
- Overrides:
removeAll
in classAbstractCollection<ElementType extends XMLObject>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
retainAll
in interfaceList<ElementType extends XMLObject>
- Overrides:
retainAll
in classAbstractCollection<ElementType extends XMLObject>
-
set
public ElementType set(int newIndex, @Nonnull ElementType element)
- Specified by:
set
in interfaceList<ElementType extends XMLObject>
- Overrides:
set
in classAbstractList<ElementType extends XMLObject>
-
size
public int size()
- Specified by:
size
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
size
in interfaceList<ElementType extends XMLObject>
- Specified by:
size
in classAbstractCollection<ElementType extends XMLObject>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
toArray
in interfaceList<ElementType extends XMLObject>
- Overrides:
toArray
in classAbstractCollection<ElementType extends XMLObject>
-
toArray
public <T> T[] toArray(@Nonnull T[] a)
- Specified by:
toArray
in interfaceCollection<ElementType extends XMLObject>
- Specified by:
toArray
in interfaceList<ElementType extends XMLObject>
- Overrides:
toArray
in classAbstractCollection<ElementType extends XMLObject>
-
-