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:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.List<T>
,java.util.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, java.util.Collection<? extends T> c)
boolean
addAll(java.util.Collection<? extends T> c)
java.util.Map<java.lang.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(java.lang.String name)
Check if this list contains an item with the given name.T
get(java.lang.String name)
Get the list item with the given name, or null if not found.java.util.Iterator<T>
iterator()
java.util.ListIterator<T>
listIterator()
T
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.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, removeRange, replaceAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Method Detail
-
asMap
public java.util.Map<java.lang.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(java.lang.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(java.lang.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)
- Specified by:
add
in interfacejava.util.Collection<T>
- Specified by:
add
in interfacejava.util.List<T>
- Overrides:
add
in classjava.util.ArrayList<T>
-
add
public void add(int index, T element)
- Specified by:
add
in interfacejava.util.List<T>
- Overrides:
add
in classjava.util.ArrayList<T>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<T>
- Specified by:
remove
in interfacejava.util.List<T>
- Overrides:
remove
in classjava.util.ArrayList<T>
-
remove
public T remove(int index)
- Specified by:
remove
in interfacejava.util.List<T>
- Overrides:
remove
in classjava.util.ArrayList<T>
-
addAll
public boolean addAll(java.util.Collection<? extends T> c)
- Specified by:
addAll
in interfacejava.util.Collection<T>
- Specified by:
addAll
in interfacejava.util.List<T>
- Overrides:
addAll
in classjava.util.ArrayList<T>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends T> c)
- Specified by:
addAll
in interfacejava.util.List<T>
- Overrides:
addAll
in classjava.util.ArrayList<T>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<T>
- Specified by:
removeAll
in interfacejava.util.List<T>
- Overrides:
removeAll
in classjava.util.ArrayList<T>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<T>
- Specified by:
retainAll
in interfacejava.util.List<T>
- Overrides:
retainAll
in classjava.util.ArrayList<T>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<T>
- Specified by:
clear
in interfacejava.util.List<T>
- Overrides:
clear
in classjava.util.ArrayList<T>
-
set
public T set(int index, T element)
- Specified by:
set
in interfacejava.util.List<T>
- Overrides:
set
in classjava.util.ArrayList<T>
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<T>
- Specified by:
iterator
in interfacejava.lang.Iterable<T>
- Specified by:
iterator
in interfacejava.util.List<T>
- Overrides:
iterator
in classjava.util.ArrayList<T>
-
listIterator
public java.util.ListIterator<T> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<T>
- Overrides:
listIterator
in classjava.util.ArrayList<T>
-
-