Interface PSequence<E>

  • Type Parameters:
    E -
    All Superinterfaces:
    java.util.Collection<E>, java.lang.Iterable<E>, java.util.List<E>, PCollection<E>
    All Known Subinterfaces:
    PStack<E>, PVector<E>
    All Known Implementing Classes:
    ConsPStack, TreePVector

    public interface PSequence<E>
    extends PCollection<E>, java.util.List<E>
    An immutable, persistent indexed collection.
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void add​(int index, E element)
      Deprecated.
      boolean addAll​(int index, java.util.Collection<? extends E> c)
      Deprecated.
      PSequence<E> minus​(int i)  
      PSequence<E> minus​(java.lang.Object e)
      Returns a sequence consisting of the elements of this without the first occurrence of e.
      PSequence<E> minusAll​(java.util.Collection<?> list)  
      PSequence<E> plus​(int i, E e)  
      PSequence<E> plus​(E e)  
      PSequence<E> plusAll​(int i, java.util.Collection<? extends E> list)  
      PSequence<E> plusAll​(java.util.Collection<? extends E> list)  
      E remove​(int index)
      Deprecated.
      E set​(int index, E element)
      Deprecated.
      PSequence<E> subList​(int start, int end)  
      PSequence<E> with​(int i, E e)  
      • 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, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArray
    • Method Detail

      • plus

        PSequence<E> plus​(E e)
        Specified by:
        plus in interface PCollection<E>
        Returns:
        a collection which contains e and all of the elements of this
      • plusAll

        PSequence<E> plusAll​(java.util.Collection<? extends E> list)
        Specified by:
        plusAll in interface PCollection<E>
        Returns:
        a collection which contains all of the elements of list and this
      • with

        PSequence<E> with​(int i,
                          E e)
        Parameters:
        i -
        e -
        Returns:
        a sequence consisting of the elements of this with e replacing the element at index i.
        Throws:
        IndexOutOfBOundsException - if i<0 || i>=this.size()
      • plus

        PSequence<E> plus​(int i,
                          E e)
        Parameters:
        i -
        e -
        Returns:
        a sequence consisting of the elements of this with e inserted at index i.
        Throws:
        IndexOutOfBOundsException - if i<0 || i>this.size()
      • plusAll

        PSequence<E> plusAll​(int i,
                             java.util.Collection<? extends E> list)
        Parameters:
        i -
        list -
        Returns:
        a sequence consisting of the elements of this with list inserted at index i.
        Throws:
        IndexOutOfBOundsException - if i<0 || i>this.size()
      • minus

        PSequence<E> minus​(java.lang.Object e)
        Returns a sequence consisting of the elements of this without the first occurrence of e.
        Specified by:
        minus in interface PCollection<E>
        Returns:
        this with a single instance of e removed, if e is in this
      • minusAll

        PSequence<E> minusAll​(java.util.Collection<?> list)
        Specified by:
        minusAll in interface PCollection<E>
        Returns:
        this with all elements of list completely removed
      • minus

        PSequence<E> minus​(int i)
        Parameters:
        i -
        Returns:
        a sequence consisting of the elements of this with the element at index i removed.
        Throws:
        IndexOutOfBOundsException - if i<0 || i>=this.size()
      • subList

        PSequence<E> subList​(int start,
                             int end)
        Specified by:
        subList in interface java.util.List<E>
      • addAll

        @Deprecated
        boolean addAll​(int index,
                       java.util.Collection<? extends E> c)
        Deprecated.
        Specified by:
        addAll in interface java.util.List<E>
      • set

        @Deprecated
        E set​(int index,
              E element)
        Deprecated.
        Specified by:
        set in interface java.util.List<E>
      • add

        @Deprecated
        void add​(int index,
                 E element)
        Deprecated.
        Specified by:
        add in interface java.util.List<E>
      • remove

        @Deprecated
        E remove​(int index)
        Deprecated.
        Specified by:
        remove in interface java.util.List<E>