Package net.bytebuddy.matcher
Class FilterableList.AbstractBase<T,S extends FilterableList<T,S>>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<T>
-
- net.bytebuddy.matcher.FilterableList.AbstractBase<T,S>
-
- Type Parameters:
T
- The type of the collection's elements.S
- The type of this list.
- All Implemented Interfaces:
java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.List<T>
,FilterableList<T,S>
- Direct Known Subclasses:
AnnotationList.AbstractBase
,ByteCodeElement.Token.TokenList
,FieldList.AbstractBase
,MethodGraph.NodeList
,MethodList.AbstractBase
,ParameterList.AbstractBase
,RecordComponentList.AbstractBase
,TypeList.AbstractBase
,TypeList.Generic.AbstractBase
- Enclosing interface:
- FilterableList<T,S extends FilterableList<T,S>>
public abstract static class FilterableList.AbstractBase<T,S extends FilterableList<T,S>> extends java.util.AbstractList<T> implements FilterableList<T,S>
A base implementation of aFilterableList
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.matcher.FilterableList
FilterableList.AbstractBase<T,S extends FilterableList<T,S>>, FilterableList.Empty<T,S extends FilterableList<T,S>>
-
-
Field Summary
Fields Modifier and Type Field Description private static int
ONLY
A convenience variable indicating the index of a list's only variable.
-
Constructor Summary
Constructors Constructor Description AbstractBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description S
filter(ElementMatcher<? super T> elementMatcher)
Filters any elements in this lists by the givenelementMatcher
and returns a list that are matched by the given matcher.T
getOnly()
Returns the only element of this list.S
subList(int fromIndex, int toIndex)
protected abstract S
wrap(java.util.List<T> values)
Represents a list of values as an instance of this instance's list type.-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, get, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString
-
-
-
-
Field Detail
-
ONLY
private static final int ONLY
A convenience variable indicating the index of a list's only variable.- See Also:
- Constant Field Values
-
-
Method Detail
-
filter
public S filter(ElementMatcher<? super T> elementMatcher)
Filters any elements in this lists by the givenelementMatcher
and returns a list that are matched by the given matcher.- Specified by:
filter
in interfaceFilterableList<T,S extends FilterableList<T,S>>
- Parameters:
elementMatcher
- The element matcher to match the elements of this list against.- Returns:
- A new list only containing the matched elements.
-
getOnly
public T getOnly()
Returns the only element of this list. If there is not exactly one element in this list, anIllegalStateException
is thrown.- Specified by:
getOnly
in interfaceFilterableList<T,S extends FilterableList<T,S>>
- Returns:
- The only element of this list.
-
subList
public S subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfaceFilterableList<T,S extends FilterableList<T,S>>
- Specified by:
subList
in interfacejava.util.List<T>
- Overrides:
subList
in classjava.util.AbstractList<T>
-
-