Interface List

  • All Superinterfaces:
    Collection
    All Known Implementing Classes:
    ArrayList, LinkedList

    public interface List
    extends Collection
    The LEAP (environment-dependent) version of the &qote;java.util.List&qote; interface. This interface appears to be exactly the same in J2SE, PJAVA and MIDP. The internal implementation is different in the three cases however.
    Version:
    1.0, 23/10/00
    Author:
    Nicolas Lhuillier
    See Also:
    (J2SE)
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(int index, Object o)
      Inserts the specified element at the specified position in this list
      void clear()
      Removes all of the elements from this list (optional operation).
      boolean contains​(Object o)
      Returns true if this list contains the specified element.
      Object get​(int index)
      Returns the element at the specified position in this list.
      int indexOf​(Object o)
      Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
      Object remove​(int index)
      Removes the element at the specified position in this list.
    • Method Detail

      • add

        void add​(int index,
                 Object o)
        Inserts the specified element at the specified position in this list
      • clear

        void clear()
        Removes all of the elements from this list (optional operation). This list will be empty after this call returns.
      • contains

        boolean contains​(Object o)
        Returns true if this list contains the specified element.
        Parameters:
        o - element whose presence in this list is to be tested.
        Returns:
        true if this list contains the specified element.
      • get

        Object get​(int index)
        Returns the element at the specified position in this list.
        Parameters:
        index - index of element to return.
        Returns:
        the element at the specified position in this list.
        Throws:
        IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).
      • indexOf

        int indexOf​(Object o)
        Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
        Parameters:
        o - element to search for.
        Returns:
        the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
      • remove

        Object remove​(int index)
        Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
        Parameters:
        index - the index of the element to removed.
        Returns:
        the element previously at the specified position.
        Throws:
        IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size()).