Package io.github.classgraph
Class MappableInfoList<T extends HasName>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<T>
-
- io.github.classgraph.InfoList<T>
-
- io.github.classgraph.MappableInfoList<T>
-
- Type Parameters:
T
- the element type
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<T>
,Collection<T>
,List<T>
,RandomAccess
- Direct Known Subclasses:
AnnotationInfoList
,AnnotationParameterValueList
,ClassInfoList
,FieldInfoList
,ModuleInfoList
,PackageInfoList
public class MappableInfoList<T extends HasName> extends InfoList<T>
A list of named objects that can be indexed by name.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, T element)
boolean
add(T element)
boolean
addAll(int index, Collection<? extends T> c)
boolean
addAll(Collection<? extends T> c)
Map<String,T>
asMap()
Get an index for this list, as a map from the name of each list item (obtained by callinggetName()
on each list item) to the list item.void
clear()
boolean
containsName(String name)
Check if this list contains an item with the given name.T
get(String name)
Get the list item with the given name, or null if not found.Iterator<T>
iterator()
ListIterator<T>
listIterator()
T
remove(int index)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
T
set(int index, T element)
-
Methods inherited from class io.github.classgraph.InfoList
equals, getAsStrings, getNames, hashCode
-
Methods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, lastIndexOf, listIterator, removeIf, replaceAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
-
-
-
Method Detail
-
asMap
public Map<String,T> asMap()
Get an index for this list, as a map from the name of each list item (obtained by callinggetName()
on each list item) to the list item.- Returns:
- An index for this list, as a map from the name of each list item (obtained by calling
getName()
on each list item) to the list item.
-
containsName
public boolean containsName(String name)
Check if this list contains an item with the given name.- Parameters:
name
- The name to search for.- Returns:
- true if this list contains an item with the given name.
-
get
public T get(String name)
Get the list item with the given name, or null if not found.- Parameters:
name
- The name to search for.- Returns:
- The list item with the given name, or null if not found.
-
add
public boolean add(T element)
-
add
public void add(int index, T element)
-
remove
public boolean remove(Object o)
-
remove
public T remove(int index)
-
addAll
public boolean addAll(Collection<? extends T> c)
-
addAll
public boolean addAll(int index, Collection<? extends T> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
clear
public void clear()
-
set
public T set(int index, T element)
-
iterator
public Iterator<T> iterator()
-
listIterator
public ListIterator<T> listIterator()
- Specified by:
listIterator
in interfaceList<T>
- Overrides:
listIterator
in classArrayList<T>
-
-