Class FilterableList.AbstractBase<T,S extends FilterableList<T,S>>

java.lang.Object
java.util.AbstractCollection<T>
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:
Iterable<T>, Collection<T>, List<T>, SequencedCollection<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 AbstractList<T> implements FilterableList<T,S>
A base implementation of a FilterableList.
  • Field Details

    • ONLY

      private static final int ONLY
      A convenience variable indicating the index of a list's only variable.
      See Also:
  • Constructor Details

    • AbstractBase

      public AbstractBase()
  • Method Details

    • filter

      public S filter(ElementMatcher<? super T> elementMatcher)
      Filters any elements in this lists by the given elementMatcher and returns a list that are matched by the given matcher.
      Specified by:
      filter in interface FilterableList<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, an IllegalStateException is thrown.
      Specified by:
      getOnly in interface FilterableList<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 interface FilterableList<T,S extends FilterableList<T,S>>
      Specified by:
      subList in interface List<T>
      Overrides:
      subList in class AbstractList<T>
    • wrap

      protected abstract S wrap(List<T> values)
      Represents a list of values as an instance of this instance's list type.
      Parameters:
      values - The values to wrap in an instance of this list's type.
      Returns:
      A wrapped instance of the given values.