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

Class BooleanList

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


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

      Constructors 
      Constructor and Description
      BooleanList()
      Creates a new empty BooleanList
      BooleanList(java.util.Collection<java.lang.Boolean> c)
      Creates a new BooleanList containing the values of the given collection
      BooleanList(int capacity)
      Creates a new empty BooealList
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean add(boolean e)
      Performs exactly the same as add(java.lang.Boolean).
      boolean add(java.lang.Boolean e) 
      void add(int index, boolean element)
      Operates exactly as add(int, java.lang.Boolean)
      void add(int index, java.lang.Boolean element) 
      void clear() 
      java.lang.Boolean get(int index) 
      boolean getB(int index)
      Operates exactly as get(int)
      boolean[] getBackingArray()
      Returns the reference to the array that backs this list.
      boolean peek()
      This method treats the underlying list as a stack.
      boolean pop()
      This method treats the underlying list as a stack.
      boolean push(boolean e)
      This method treats the underlying list as a stack.
      java.lang.Boolean remove(int index) 
      boolean removeB(int index)
      Operates exactly as remove(int)
      boolean set(int index, boolean element)
      Operates exactly as set(int, java.lang.Boolean)
      java.lang.Boolean set(int index, java.lang.Boolean element) 
      int size() 
      static java.util.List<java.lang.Boolean> unmodifiableView(boolean[] array, int length)
      Creates an returns an unmodifiable view of the given boolean array that requires only a small object allocation.
      static BooleanList view(boolean[] array, int length)
      Creates and returns a view of the given boolean 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

        addAll, 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

        addAll, 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

      • BooleanList

        public BooleanList()
        Creates a new empty BooleanList
      • BooleanList

        public BooleanList(int capacity)
        Creates a new empty BooealList
        Parameters:
        capacity - the starting internal capacity of the list
      • BooleanList

        public BooleanList(java.util.Collection<java.lang.Boolean> c)
        Creates a new BooleanList containing the values of the given collection
        Parameters:
        c - the collection of values to fill this boolean list with
    • Method Detail

      • clear

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

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

        public boolean add(boolean e)
        Performs exactly the same as add(java.lang.Boolean).
        Parameters:
        e - the value to add
        Returns:
        true if it was added, false otherwise
      • push

        public boolean push(boolean e)
        This method treats the underlying list as a stack. Pushes an item onto the top of this "stack".
        Parameters:
        e - the item to push onto the stack
        Returns:
        the value added to the stack
      • pop

        public boolean pop()
        This method treats the underlying list as a stack. Removes the item at the top of this "stack" and returns that item as the value.
        Returns:
        the item at the top of this stack (the last item pushed onto it)
      • peek

        public boolean peek()
        This method treats the underlying list as a stack. Gets the item at the top of this "stack" and returns that item as the value, but leaves it on the stack.
        Returns:
        the item at the top of this stack (the last item pushed onto it)
      • add

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

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

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

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

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

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

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

        public boolean removeB(int index)
        Operates exactly as remove(int)
        Parameters:
        index - the index to remove
        Returns:
        the value removed
      • remove

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

        public boolean[] getBackingArray()
        Returns the reference to the array that backs this list. Alterations to the array will be visible to the DoubelList and vise versa. The array returned may not the the same size as the value returned by size()
        Returns:
        the underlying array used by this BooleanList
      • unmodifiableView

        public static java.util.List<java.lang.Boolean> unmodifiableView(boolean[] array,
                                                                         int length)
        Creates an returns an unmodifiable view of the given boolean 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 BooleanList view(boolean[] array,
                                       int length)
        Creates and returns a view of the given boolean 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 a BooleanList object
        length - the initial length of the list
        Returns:
        a BoolaenList backed by the given array, unless modified to the point of requiring the allocation of a new array

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.