Class PersistentVector<E>

    • Method Detail

      • empty

        public static <T> PersistentVector<T> empty()
        Returns the empty ImList (there only needs to be one)
      • emptyMutable

        public static <T> PersistentVector.MutVector<T> emptyMutable()
        Returns a new mutable vector. For some reason calling empty().mutable() sometimes requires an explicit type parameter in Java, so this convenience method works around that.
      • get

        public E get​(int i)
        Returns the item specified by the given index.
        Specified by:
        get in interface List<E>
      • replace

        public PersistentVector<E> replace​(int i,
                                           E val)
        Replace the item at the given index. Note: i.replace(i.size(), o) used to be equivalent to i.concat(o), but it probably won't be for the RRB tree implementation, so this will change too.
        Specified by:
        replace in interface BaseList<E>
        Specified by:
        replace in interface ImList<E>
        Parameters:
        i - the index where the value should be stored.
        val - the value to store
        Returns:
        a new ImList with the replaced item
      • size

        public int size()
        Returns the number of items in this collection or iterable.
        Specified by:
        size in interface Collection<E>
        Specified by:
        size in interface List<E>
        Specified by:
        size in interface Sized
      • append

        public PersistentVector<E> append​(E val)
        Inserts a new item at the end of the Vecsicle.
        Specified by:
        append in interface BaseList<E>
        Specified by:
        append in interface ImList<E>
        Parameters:
        val - the value to insert
        Returns:
        a new Vecsicle with the additional item.