Class BoolList


public final class BoolList extends ElementList
Resizable-array implementation for native booleans.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Summary

    Fields inherited from class org.basex.util.list.ElementList

    factor, size
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    BoolList(long capacity)
    Constructor with initial capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(boolean element)
    Adds an element.
    add(boolean... elements)
    Adds elements to the array.
    boolean
     
    boolean[]
    Returns an array with all elements and invalidates the internal array.
    boolean
    get(int index)
    Returns the element at the specified index.
    boolean[]
    Returns an array with all elements and resets the array size.
    boolean
    Returns the uppermost element on the stack, without removing it.
    boolean
    pop()
    Pops the uppermost element from the stack.
    void
    push(boolean element)
    Pushes an element onto the stack.
    void
    set(int index, boolean element)
    Stores an element at the specified index.
    boolean[]
    Finishes the int array.
     

    Methods inherited from class org.basex.util.list.ElementList

    isEmpty, newCapacity, newCapacity, reset, size, size

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • BoolList

      public BoolList()
      Default constructor.
    • BoolList

      public BoolList(long capacity)
      Constructor with initial capacity.
      Parameters:
      capacity - array capacity
  • Method Details

    • add

      public BoolList add(boolean element)
      Adds an element.
      Parameters:
      element - element to be added
      Returns:
      self reference
    • add

      public BoolList add(boolean... elements)
      Adds elements to the array.
      Parameters:
      elements - elements to be added
      Returns:
      self reference
    • get

      public boolean get(int index)
      Returns the element at the specified index.
      Parameters:
      index - index of the element to return
      Returns:
      element
    • set

      public void set(int index, boolean element)
      Stores an element at the specified index.
      Parameters:
      index - index of the element to replace
      element - element to be stored
    • pop

      public boolean pop()
      Pops the uppermost element from the stack.
      Returns:
      the popped element
    • push

      public void push(boolean element)
      Pushes an element onto the stack.
      Parameters:
      element - element
    • peek

      public boolean peek()
      Returns the uppermost element on the stack, without removing it.
      Returns:
      uppermost element
    • toArray

      public boolean[] toArray()
      Finishes the int array.
      Returns:
      int array
    • next

      public boolean[] next()
      Returns an array with all elements and resets the array size.
      Returns:
      array
    • finish

      public boolean[] finish()
      Returns an array with all elements and invalidates the internal array. Warning: the function must only be called if the list is discarded afterwards.
      Returns:
      array (internal representation!)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object