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.PotentiallyUnmodifiableList<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
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
serialVersionUID-
Fields inherited from class io.github.classgraph.PotentiallyUnmodifiableList
modifiable
-
-
Constructor Summary
Constructors Constructor Description MappableInfoList()
Constructor.MappableInfoList(int sizeHint)
Constructor.MappableInfoList(java.util.Collection<T> infoCollection)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.-
Methods inherited from class io.github.classgraph.InfoList
equals, getAsStrings, getAsStringsWithSimpleNames, getNames, hashCode
-
Methods inherited from class io.github.classgraph.PotentiallyUnmodifiableList
add, add, addAll, addAll, clear, iterator, listIterator, makeUnmodifiable, remove, remove, removeAll, retainAll, set
-
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
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
serialVersionUID- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MappableInfoList
MappableInfoList()
Constructor.
-
MappableInfoList
MappableInfoList(int sizeHint)
Constructor.- Parameters:
sizeHint
- the size hint
-
MappableInfoList
MappableInfoList(java.util.Collection<T> infoCollection)
Constructor.- Parameters:
infoCollection
- the initial elements
-
-
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.
-
-