Class FilterableList.AbstractBase<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.
      • Fields inherited from class java.util.AbstractList

        modCount
    • 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 given elementMatcher 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
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArray
    • 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
    • Constructor Detail

      • AbstractBase

        public AbstractBase()
    • Method Detail

      • 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 java.util.List<T>
        Overrides:
        subList in class java.util.AbstractList<T>
      • wrap

        protected abstract S wrap​(java.util.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.