Documentation of 'jsat.utils.IntList' Java class
IntList
jsat.utils

Class IntList

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<java.lang.Integer>, java.util.Collection<java.lang.Integer>, java.util.List<java.lang.Integer>, java.util.RandomAccess


    public class IntList
    extends java.util.AbstractList<java.lang.Integer>
    implements java.io.Serializable, java.util.RandomAccess
    Provides a modifiable implementation of a List using a int array. This provides considerable memory efficency improvements over using an ArrayList to store integers. Null is not allowed into the list.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      IntList()
      Creates a new IntList
      IntList(java.util.Collection<java.lang.Integer> c) 
      IntList(int capacity)
      Creates a new IntList with the given initial capacity
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean add(int e)
      Operates exactly as add(java.lang.Integer)
      boolean add(java.lang.Integer e) 
      void add(int index, int element)
      Operates exactly as add(int, java.lang.Integer)
      void add(int index, java.lang.Integer element) 
      boolean addAll(java.util.Collection<? extends java.lang.Integer> c) 
      void clear() 
      java.lang.Integer get(int index) 
      int getI(int index)
      Operates exactly as get(int)
      static IntList range(int end)
      Returns a new IntList containing values in the range [0, end)
      static IntList range(int start, int end)
      Returns a new IntList containing values in the given range
      static IntList range(int start, int end, int step)
      Returns a new IntList containing values in the given range
      java.lang.Integer remove(int index) 
      int set(int index, int element)
      Operates exactly as set(int, java.lang.Integer)
      java.lang.Integer set(int index, java.lang.Integer element) 
      int size() 
      void sort()
      Efficiently sorts this list of integers using Arrays.sort(int[]).
      java.util.stream.IntStream streamInts() 
      static java.util.List<java.lang.Integer> unmodifiableView(int[] array, int length)
      Creates and returns an unmodifiable view of the given int array that requires only a small object allocation.
      static IntList view(int[] array)
      Creates and returns a view of the given int array that requires only a small object allocation.
      static IntList view(int[] array, int length)
      Creates and returns a view of the given int array that requires only a small object allocation.
      • Methods inherited from class java.util.AbstractList

        addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, subList
      • Methods inherited from class java.util.AbstractCollection

        contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.List

        contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • IntList

        public IntList()
        Creates a new IntList
      • IntList

        public IntList(int capacity)
        Creates a new IntList with the given initial capacity
        Parameters:
        capacity - the starting internal storage space size
      • IntList

        public IntList(java.util.Collection<java.lang.Integer> c)
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<java.lang.Integer>
        Specified by:
        clear in interface java.util.List<java.lang.Integer>
        Overrides:
        clear in class java.util.AbstractList<java.lang.Integer>
      • set

        public int set(int index,
                       int element)
        Operates exactly as set(int, java.lang.Integer)
        Parameters:
        index - the index to set
        element - the value to set
        Returns:
        the previous value at the index
      • set

        public java.lang.Integer set(int index,
                                     java.lang.Integer element)
        Specified by:
        set in interface java.util.List<java.lang.Integer>
        Overrides:
        set in class java.util.AbstractList<java.lang.Integer>
      • add

        public void add(int index,
                        int element)
        Operates exactly as add(int, java.lang.Integer)
        Parameters:
        index - the index to add the value into
        element - the value to add
      • add

        public void add(int index,
                        java.lang.Integer element)
        Specified by:
        add in interface java.util.List<java.lang.Integer>
        Overrides:
        add in class java.util.AbstractList<java.lang.Integer>
      • add

        public boolean add(int e)
        Operates exactly as add(java.lang.Integer)
        Parameters:
        e - the value to add
        Returns:
        true if it was added, false otherwise
      • add

        public boolean add(java.lang.Integer e)
        Specified by:
        add in interface java.util.Collection<java.lang.Integer>
        Specified by:
        add in interface java.util.List<java.lang.Integer>
        Overrides:
        add in class java.util.AbstractList<java.lang.Integer>
      • getI

        public int getI(int index)
        Operates exactly as get(int)
        Parameters:
        index - the index of the value to get
        Returns:
        the value at the index
      • get

        public java.lang.Integer get(int index)
        Specified by:
        get in interface java.util.List<java.lang.Integer>
        Specified by:
        get in class java.util.AbstractList<java.lang.Integer>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<java.lang.Integer>
        Specified by:
        size in interface java.util.List<java.lang.Integer>
        Specified by:
        size in class java.util.AbstractCollection<java.lang.Integer>
      • addAll

        public boolean addAll(java.util.Collection<? extends java.lang.Integer> c)
        Specified by:
        addAll in interface java.util.Collection<java.lang.Integer>
        Specified by:
        addAll in interface java.util.List<java.lang.Integer>
        Overrides:
        addAll in class java.util.AbstractCollection<java.lang.Integer>
      • remove

        public java.lang.Integer remove(int index)
        Specified by:
        remove in interface java.util.List<java.lang.Integer>
        Overrides:
        remove in class java.util.AbstractList<java.lang.Integer>
      • sort

        public void sort()
        Efficiently sorts this list of integers using Arrays.sort(int[]).
      • unmodifiableView

        public static java.util.List<java.lang.Integer> unmodifiableView(int[] array,
                                                                         int length)
        Creates and returns an unmodifiable view of the given int array that requires only a small object allocation.
        Parameters:
        array - the array to wrap into an unmodifiable list
        length - the number of values of the array to use, starting from zero
        Returns:
        an unmodifiable list view of the array
      • view

        public static IntList view(int[] array,
                                   int length)
        Creates and returns a view of the given int array that requires only a small object allocation. Changes to the list will be reflected in the array up to a point. If the modification would require increasing the capacity of the array, a new array will be allocated - at which point operations will no longer be reflected in the original array.
        Parameters:
        array - the array to wrap by an IntList object
        length - the initial length of the list
        Returns:
        an IntList backed by the given array, unless modified to the point of requiring the allocation of a new array
      • view

        public static IntList view(int[] array)
        Creates and returns a view of the given int array that requires only a small object allocation. Changes to the list will be reflected in the array up to a point. If the modification would require increasing the capacity of the array, a new array will be allocated - at which point operations will no longer be reflected in the original array.
        Parameters:
        array - the array to wrap by an IntList object
        Returns:
        an IntList backed by the given array, unless modified to the point of requiring the allocation of a new array
      • streamInts

        public java.util.stream.IntStream streamInts()
        Returns:
        a sequential stream of integers with this as its source
      • range

        public static IntList range(int start,
                                    int end,
                                    int step)
        Returns a new IntList containing values in the given range
        Parameters:
        start - the starting value (inclusive)
        end - the ending value (exclusive)
        step - the step size
        Returns:
        a new IntList populated by integer values as if having run through a for loop
      • range

        public static IntList range(int start,
                                    int end)
        Returns a new IntList containing values in the given range
        Parameters:
        start - the starting value (inclusive)
        end - the ending value (exclusive)
        Returns:
        a new IntList populated by integer values as if having run through a for loop
      • range

        public static IntList range(int end)
        Returns a new IntList containing values in the range [0, end)
        Parameters:
        end - the ending value (exclusive)
        Returns:
        a new IntList populated by integer values as if having run through a for loop

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.