Class IndexableSet<E>

  • Type Parameters:
    E - the element type
    All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.Set<E>

    public class IndexableSet<E>
    extends InsertionOrderSet<E>
    The class IndexableSet
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      IndexableSet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      E get​(int index)
      Gets the element of the given index

      Note: use with caution
      int getIndex​(E element)
      Gets the index of the given element
      • Methods inherited from class java.util.LinkedHashSet

        spliterator
      • Methods inherited from class java.util.HashSet

        clear, clone, contains, isEmpty, iterator, remove, size
      • Methods inherited from class java.util.AbstractSet

        equals, hashCode, removeAll
      • Methods inherited from class java.util.AbstractCollection

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

        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.Set

        addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
    • Constructor Detail

      • IndexableSet

        public IndexableSet()
    • Method Detail

      • get

        public E get​(int index)
        Gets the element of the given index

        Note: use with caution
        Parameters:
        index - the index
        Returns:
        the element of the given index or throws an IndexOutOfBoundsException
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
      • getIndex

        public int getIndex​(E element)
        Gets the index of the given element
        Parameters:
        element - the element
        Returns:
        the index of the element or -1 if its not exists