Package ghidra.program.model.pcode

# Class ListLinked<T>

java.lang.Object
ghidra.program.model.pcode.ListLinked<T>

public class ListLinked<T> extends Object
A better linked list implementation than provided by java.util. TODO: Looks like the main benefit is a non-failing iterator. In JDK 1.5 this may not be needed. 1.5 has better Iterators in the collections classes.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Iterator<T>`
  `add(T o)`
  Add object to end of the list, any existing iterators remain valid
  `void`
  `clear()`
  Get rid of all entries on the linked list.
  `T`
  `first()`
  `Iterator<T>`
  `insertAfter(Iterator<T> itr, T o)`
  Insert new object AFTER object pointed to by iterator, other Iterators remain valid
  `Iterator<T>`
  `insertBefore(Iterator<T> itr, T o)`
  Insert new object BEFORE object pointed to by iterator, other Iterators remain valid
  `Iterator<T>`
  `iterator()`
  `T`
  `last()`
  `void`
  `remove(Iterator<T> itr)`
  Remove object from list indicated by Iterator, all iterators that point to objects other than this one remain valid

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### add

    public Iterator<T> add(T o)
    Add object to end of the list, any existing iterators remain valid
    Parameters:
      `o` - -- Object to be added
    Returns:
      Iterator to new object

  - ### insertAfter

    public Iterator<T> insertAfter(Iterator<T> itr, T o)
    Insert new object AFTER object pointed to by iterator, other Iterators remain valid
    Parameters:
      `itr` - Iterator to existing object
      `o` - New object to add
    Returns:
      Iterator to new object

  - ### insertBefore

    public Iterator<T> insertBefore(Iterator<T> itr, T o)
    Insert new object BEFORE object pointed to by iterator, other Iterators remain valid
    Parameters:
      `itr` - Iterator to existing object
      `o` - New object to add
    Returns:
      Iterator to new object

  - ### remove

    public void remove(Iterator<T> itr)
    Remove object from list indicated by Iterator, all iterators that point to objects other than this one remain valid
    Parameters:
      `itr` - Iterator to object to be removed

  - ### iterator

    public Iterator<T> iterator()
    Returns:
      an iterator over this linked list

  - ### clear

    public void clear()
    Get rid of all entries on the linked list.

  - ### first

    public T first()
    Returns:
      the first element in the list (or null)

  - ### last

    public T last()
    Returns:
      the last element in the list (or null)