Class AbstractCharList

    • Method Detail

      • addAll

        public boolean addAll​(int index,
                              Collection<? extends Character> c)
        Adds all of the elements in the specified collection to this list (optional operation).
        Specified by:
        addAll in interface List<Character>
      • indexOf

        public int indexOf​(char k)
        Description copied from interface: CharList
        Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.
        Specified by:
        indexOf in interface CharList
        See Also:
        List.indexOf(Object)
      • lastIndexOf

        public int lastIndexOf​(char k)
        Description copied from interface: CharList
        Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.
        Specified by:
        lastIndexOf in interface CharList
        See Also:
        List.lastIndexOf(Object)
      • size

        public void size​(int size)
        Description copied from interface: CharList
        Sets the size of this list.

        If the specified size is smaller than the current size, the last elements are discarded. Otherwise, they are filled with 0/null/false.

        Specified by:
        size in interface CharList
        Parameters:
        size - the new size.
      • removeElements

        public void removeElements​(int from,
                                   int to)
        Removes (hopefully quickly) elements of this type-specific list.

        This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

        Specified by:
        removeElements in interface CharList
        Parameters:
        from - the start index (inclusive).
        to - the end index (exclusive).
      • addElements

        public void addElements​(int index,
                                char[] a,
                                int offset,
                                int length)
        Add (hopefully quickly) elements to this type-specific list.

        This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

        Specified by:
        addElements in interface CharList
        Parameters:
        index - the index at which to add elements.
        a - the array containing the elements.
        offset - the offset of the first element to add.
        length - the number of elements to add.
      • addElements

        public void addElements​(int index,
                                char[] a)
        Add (hopefully quickly) elements to this type-specific list.

        This implementation delegates to the analogous method for array fragments.

        Specified by:
        addElements in interface CharList
        Parameters:
        index - the index at which to add elements.
        a - the array containing the elements.
      • getElements

        public void getElements​(int from,
                                char[] a,
                                int offset,
                                int length)
        Copies (hopefully quickly) elements of this type-specific list into the given array.

        This is a trivial iterator-based implementation. It is expected that implementations will override this method with a more optimized version.

        Specified by:
        getElements in interface CharList
        Parameters:
        from - the start index (inclusive).
        a - the destination array.
        offset - the offset into the destination array where to store the first element copied.
        length - the number of elements to be copied.
      • compareTo

        public int compareTo​(List<? extends Character> l)
        Compares this list to another object. If the argument is a List, this method performs a lexicographical comparison; otherwise, it throws a ClassCastException.
        Specified by:
        compareTo in interface Comparable<List<? extends Character>>
        Parameters:
        l - a list.
        Returns:
        if the argument is a List, a negative integer, zero, or a positive integer as this list is lexicographically less than, equal to, or greater than the argument.
        Throws:
        ClassCastException - if the argument is not a list.
      • push

        public void push​(char o)
        Description copied from interface: CharStack
        Pushes the given object on the stack.
        Specified by:
        push in interface CharStack
        Parameters:
        o - the object to push on the stack.
        See Also:
        Stack.push(Object)
      • popChar

        public char popChar()
        Description copied from interface: CharStack
        Pops the top off the stack.
        Specified by:
        popChar in interface CharStack
        Returns:
        the top of the stack.
        See Also:
        Stack.pop()
      • topChar

        public char topChar()
        Description copied from interface: CharStack
        Peeks at the top of the stack (optional operation).
        Specified by:
        topChar in interface CharStack
        Returns:
        the top of the stack.
        See Also:
        Stack.top()
      • peekChar

        public char peekChar​(int i)
        Description copied from interface: CharStack
        Peeks at an element on the stack (optional operation).
        Specified by:
        peekChar in interface CharStack
        Parameters:
        i - an index from the stop of the stack (0 represents the top).
        Returns:
        the i-th element on the stack.
        See Also:
        Stack.peek(int)
      • rem

        public boolean rem​(char k)
        Removes a single instance of the specified element from this collection, if it is present (optional operation).

        This implementation delegates to indexOf().

        Specified by:
        rem in interface CharCollection
        Overrides:
        rem in class AbstractCharCollection
        See Also:
        List.remove(Object)
      • addAll

        public boolean addAll​(int index,
                              CharList l)
        Inserts all of the elements in the specified type-specific list into this type-specific list at the specified position (optional operation).

        This implementation delegates to the type-specific version of List.addAll(int, Collection).

        Specified by:
        addAll in interface CharList
        See Also:
        List.add(int,Object)