Documentation of 'org.ddogleg.struct.LinkedList' Java class
LinkedList
org.ddogleg.struct

Class LinkedList<T>



  • public class LinkedList<T>
    extends java.lang.Object
    A double linked list. Internal data structures are recycled to minimize creation of new memory.
    • Constructor Detail

      • LinkedList

        public LinkedList()
    • Method Detail

      • reset

        public void reset()
        Puts the linked list back into its initial state. Elements are saved for later use.
      • isEmpty

        public boolean isEmpty()
        Checks to see if there are no elements in the list
        Returns:
        true if empty or false if not
      • getElement

        public LinkedList.Element getElement(int index,
                                             boolean fromFront)
        Returns the N'th element when counting from the from or from the back
        Parameters:
        index - Number of elements away from the first or last element. Must be positive.
        Returns:
        if true then the number of elements will be from first otherwise last
      • pushHead

        public LinkedList.Element pushHead(T object)
        Adds the element to the front of the list.
        Parameters:
        object - Object being added.
        Returns:
        The element it was placed inside of
      • pushTail

        public LinkedList.Element pushTail(T object)
        Adds the element to the back of the list.
        Parameters:
        object - Object being added.
        Returns:
        The element it was placed inside of
      • insertAfter

        public LinkedList.Element insertAfter(LinkedList.Element previous,
                                              T object)
        Inserts the object into a new element after the provided element.
        Parameters:
        previous - Element which will be before the new one
        object - The object which goes into the new element
        Returns:
        The new element
      • insertBefore

        public LinkedList.Element insertBefore(LinkedList.Element next,
                                               T object)
        Inserts the object into a new element before the provided element.
        Parameters:
        next - Element which will be after the new one
        object - The object which goes into the new element
        Returns:
        The new element
      • remove

        public void remove(LinkedList.Element element)
        Removes the element from the list and saves the element data structure for later reuse.
        Parameters:
        element - The item which is to be removed from the list
      • removeHead

        public java.lang.Object removeHead()
        Removes the first element from the list
        Returns:
        The object which was contained in the first element
      • removeTail

        public java.lang.Object removeTail()
        Removes the last element from the list
        Returns:
        The object which was contained in the lsat element
      • find

        public LinkedList.Element find(T object)
        Returns the first element which contains 'object' starting from the head.
        Parameters:
        object - Object which is being searched for
        Returns:
        First element which contains object or null if none can be found
      • getHead

        public LinkedList.Element getHead()
        Returns the first element in the list
        Returns:
        first element
      • getTail

        public LinkedList.Element getTail()
        Returns the last element in the list
        Returns:
        last element
      • addAll

        public void addAll(java.util.List<T> list)
        Add all elements in list into this linked list
        Parameters:
        list - List
      • addAll

        public void addAll(T[] array,
                           int first,
                           int length)
        Adds the specified elements from array into this list
        Parameters:
        array - The array
        first - First element to be added
        length - The number of elements to be added
      • size

        public int size()
        Returns the number of elements in the list

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.