Class CaseInsensitiveList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.String>, java.util.Collection<java.lang.String>, java.util.List<java.lang.String>, java.util.RandomAccess

    public final class CaseInsensitiveList
    extends java.util.ArrayList<java.lang.String>
    This class is a copy of ArrayList implementation, specialized for Strings. Comparisons are case-sensitive. The list cannot contain null values. In case of adding null value NullPointerException is thrown.
    Author:
    svata
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      CaseInsensitiveList()
      Constructs an empty list with an initial capacity of ten.
      CaseInsensitiveList​(int initialCapacity)
      Constructs an empty list with the specified initial capacity.
      CaseInsensitiveList​(java.util.Collection<java.lang.String> c)
      Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.lang.String element)
      Inserts the specified element at the specified position in this list.
      boolean add​(java.lang.String e)
      Appends the specified element to the end of this list.
      boolean addAll​(int index, java.util.Collection<? extends java.lang.String> c)  
      boolean addAll​(java.util.Collection<? extends java.lang.String> c)  
      java.lang.Object clone()  
      int indexOf​(java.lang.Object elem)  
      int lastIndexOf​(java.lang.Object elem)  
      boolean remove​(java.lang.Object o)  
      boolean removeAll​(java.util.Collection<?> c)  
      boolean retainAll​(java.util.Collection<?> c)  
      • Methods inherited from class java.util.ArrayList

        clear, contains, ensureCapacity, equals, forEach, get, hashCode, isEmpty, iterator, listIterator, listIterator, remove, removeIf, removeRange, replaceAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

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

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • CaseInsensitiveList

        public CaseInsensitiveList​(int initialCapacity)
        Constructs an empty list with the specified initial capacity.
        Parameters:
        initialCapacity - The initial capacity of the list.
        Throws:
        java.lang.IllegalArgumentException - if the specified initial capacity is negative
      • CaseInsensitiveList

        public CaseInsensitiveList()
        Constructs an empty list with an initial capacity of ten.
      • CaseInsensitiveList

        public CaseInsensitiveList​(java.util.Collection<java.lang.String> c)
        Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. The ArrayList instance has an initial capacity of 110% the size of the specified collection.
        Parameters:
        c - The collection whose elements are to be placed into this list.
        Throws:
        java.lang.NullPointerException - if the specified collection is null.
    • Method Detail

      • add

        public boolean add​(java.lang.String e)
        Appends the specified element to the end of this list.
        Specified by:
        add in interface java.util.Collection<java.lang.String>
        Specified by:
        add in interface java.util.List<java.lang.String>
        Overrides:
        add in class java.util.ArrayList<java.lang.String>
        Parameters:
        e - element to be appended to this list
        Returns:
        true (as specified by Collection.add(E))
        Throws:
        java.lang.NullPointerException - if null value is added
      • add

        public void add​(int index,
                        java.lang.String element)
        Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).
        Specified by:
        add in interface java.util.List<java.lang.String>
        Overrides:
        add in class java.util.ArrayList<java.lang.String>
        Parameters:
        index - index at which the specified element is to be inserted
        element - element to be inserted
        Throws:
        java.lang.IndexOutOfBoundsException
        java.lang.NullPointerException - if null value is added
      • addAll

        public boolean addAll​(java.util.Collection<? extends java.lang.String> c)
        Specified by:
        addAll in interface java.util.Collection<java.lang.String>
        Specified by:
        addAll in interface java.util.List<java.lang.String>
        Overrides:
        addAll in class java.util.ArrayList<java.lang.String>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends java.lang.String> c)
        Specified by:
        addAll in interface java.util.List<java.lang.String>
        Overrides:
        addAll in class java.util.ArrayList<java.lang.String>
      • indexOf

        public int indexOf​(java.lang.Object elem)
        Specified by:
        indexOf in interface java.util.List<java.lang.String>
        Overrides:
        indexOf in class java.util.ArrayList<java.lang.String>
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object elem)
        Specified by:
        lastIndexOf in interface java.util.List<java.lang.String>
        Overrides:
        lastIndexOf in class java.util.ArrayList<java.lang.String>
      • clone

        public java.lang.Object clone()
        Overrides:
        clone in class java.util.ArrayList<java.lang.String>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<java.lang.String>
        Specified by:
        remove in interface java.util.List<java.lang.String>
        Overrides:
        remove in class java.util.ArrayList<java.lang.String>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<java.lang.String>
        Specified by:
        removeAll in interface java.util.List<java.lang.String>
        Overrides:
        removeAll in class java.util.ArrayList<java.lang.String>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<java.lang.String>
        Specified by:
        retainAll in interface java.util.List<java.lang.String>
        Overrides:
        retainAll in class java.util.ArrayList<java.lang.String>