IntListAdapter
cern.colt.list.tint

Class IntListAdapter

  • All Implemented Interfaces:
    Iterable, Collection, List


    public class IntListAdapterextends AbstractListimplements List
    Adapter that permits an AbstractIntList to be viewed and treated as a JDK 1.2 AbstractList. Makes the contained list compatible with the JDK 1.2 Collections Framework.

    Any attempt to pass elements other than java.lang.Number to setter methods will throw a java.lang.ClassCastException. java.lang.Number.intValue() is used to convert objects into primitive values which are then stored in the backing templated list. Getter methods return java.lang.Integer objects.

    • Constructor Detail

      • IntListAdapter

        public IntListAdapter(AbstractIntList content)
        Constructs a list backed by the specified content list.
    • Method Detail

      • add

        public void add(int index,       Object element)
        Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indexes).

        Specified by:
        add in interface List
        Overrides:
        add in class AbstractList
        Parameters:
        index - index at which the specified element is to be inserted.
        element - element to be inserted.
        Throws:
        ClassCastException - if the class of the specified element prevents it from being added to this list.
        IllegalArgumentException - if some aspect of the specified element prevents it from being added to this list.
        IndexOutOfBoundsException - index is out of range (index < 0 || index > size()).
      • get

        public Object get(int index)
        Returns the element at the specified position in this list.
        Specified by:
        get in interface List
        Specified by:
        get in class AbstractList
        Parameters:
        index - index of element to return.
        Returns:
        the element at the specified position in this list.
        Throws:
        IndexOutOfBoundsException - if the given index is out of range ( index < 0 || index >= size()).
      • remove

        public Object remove(int index)
        Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indexes). Returns the element that was removed from the list.

        Specified by:
        remove in interface List
        Overrides:
        remove in class AbstractList
        Parameters:
        index - the index of the element to remove.
        Returns:
        the element previously at the specified position.
        Throws:
        IndexOutOfBoundsException - if the specified index is out of range ( index < 0 || index >= size()).
      • set

        public Object set(int index,         Object element)
        Replaces the element at the specified position in this list with the specified element (optional operation).

        Specified by:
        set in interface List
        Overrides:
        set in class AbstractList
        Parameters:
        index - index of element to replace.
        element - element to be stored at the specified position.
        Returns:
        the element previously at the specified position.
        Throws:
        ClassCastException - if the class of the specified element prevents it from being added to this list.
        IllegalArgumentException - if some aspect of the specified element prevents it from being added to this list.
        IndexOutOfBoundsException - if the specified index is out of range ( index < 0 || index >= size()).
      • size

        public int size()
        Returns the number of elements in this list.
        Specified by:
        size in interface Collection
        Specified by:
        size in interface List
        Specified by:
        size in class AbstractCollection
        Returns:
        the number of elements in this list.

SCaVis 1.7 © jWork.org