PCJ API
Version 1.2

bak.pcj.list
Interface BooleanList

All Superinterfaces:
BooleanCollection
All Known Subinterfaces:
BooleanDeque, BooleanStack
All Known Implementing Classes:
AbstractBooleanList, BooleanArrayDeque, BooleanArrayStack, UnmodifiableBooleanList

public interface BooleanList
extends BooleanCollection

This interface represents lists of boolean values.

Since:
1.0
See Also:
List

Method Summary
 void add(int index, boolean v)
          Adds an element to this list at a specified index.
 boolean addAll(int index, BooleanCollection c)
          Adds all the elements of a specified collection to this list starting at a specified index.
 boolean get(int index)
          Returns the element at a specified position in this list.
 int indexOf(boolean c)
          Returns the index of the first occurance of a specified element in this list.
 int indexOf(int index, boolean c)
          Returns the index of the first occurance of a specified element in this list after or at a specified index.
 int lastIndexOf(boolean c)
          Returns the index of the last occurance of a specified element in this list.
 int lastIndexOf(int index, boolean c)
          Returns the index of the last occurance of a specified element in this list before a specified index.
 BooleanListIterator listIterator()
          Returns a list iterator over this list.
 BooleanListIterator listIterator(int index)
          Returns a list iterator over this list, starting from a specified index.
 boolean removeElementAt(int index)
          Removes the element at a specified index in this list.
 boolean set(int index, boolean v)
          Sets a specified element to a new value.
 
Methods inherited from interface bak.pcj.BooleanCollection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, trimToSize
 

Method Detail

add

public void add(int index,
                boolean v)
Adds an element to this list at a specified index. All elements from the specified index and forward are pushed to their successor's indices.

Parameters:
index - the index at which to add the element. If index == size() the element is appended to this list.
v - the boolean value to add to this list.
Throws:
UnsupportedOperationException - if the operation is not supported by this list.
IndexOutOfBoundsException - if index does not denote a valid insertion position (valid: 0 - size()).
See Also:
BooleanCollection.add(boolean), BooleanCollection.addAll(BooleanCollection), addAll(int,BooleanCollection)

addAll

public boolean addAll(int index,
                      BooleanCollection c)
Adds all the elements of a specified collection to this list starting at a specified index. The elements are inserted in the specified collection's iteration order. All elements from the specified index and forward are pushed to their successors' indices (c.size() indices).

Parameters:
index - the index at which to insert the elements of the specified collection. If index == size() the elements are appended to this list.
c - the collection whose elements to add to this list.
Returns:
true if this list was modified as a result of adding the elements of c; returns false otherwise.
Throws:
UnsupportedOperationException - if the operation is not supported by this list.
NullPointerException - if c is null.
IndexOutOfBoundsException - if index does not denote a valid insertion position (valid: 0 - size()).
See Also:
BooleanCollection.add(boolean), add(int, boolean), BooleanCollection.addAll(BooleanCollection)

get

public boolean get(int index)
Returns the element at a specified position in this list.

Parameters:
index - the position of the element to return.
Returns:
the element at the specified position.
Throws:
IndexOutOfBoundsException - if index does not denote a valid index in this list.

indexOf

public int indexOf(boolean c)
Returns the index of the first occurance of a specified element in this list.

Parameters:
c - the element to find.
Returns:
the index of the first occurance of the specified element in this list; returns -1, if the element is not contained in this list.

indexOf

public int indexOf(int index,
                   boolean c)
Returns the index of the first occurance of a specified element in this list after or at a specified index.

Parameters:
c - the element to find.
index - the index at which to start the search.
Returns:
the index of the first occurance of the specified element in this list; returns -1, if the element is not contained in this list.
Throws:
IndexOutOfBoundsException - if index does not denote a valid iteration position (valid: 0 - size()).
Since:
1.2

lastIndexOf

public int lastIndexOf(boolean c)
Returns the index of the last occurance of a specified element in this list.

Parameters:
c - the element to find.
Returns:
the index of the last occurance of the specified element in this list; returns -1, if the element is not contained in this list.

lastIndexOf

public int lastIndexOf(int index,
                       boolean c)
Returns the index of the last occurance of a specified element in this list before a specified index.

Parameters:
c - the element to find.
index - the index at which to start the search. Note that the element at index is not included in the search.
Returns:
the index of the last occurance of the specified element in this list; returns -1, if the element is not contained in this list.
Throws:
IndexOutOfBoundsException - if index does not denote a valid iteration position (valid: 0 - size()).
Since:
1.2

listIterator

public BooleanListIterator listIterator()
Returns a list iterator over this list.

Returns:
a list iterator over this list.

listIterator

public BooleanListIterator listIterator(int index)
Returns a list iterator over this list, starting from a specified index.

Parameters:
index - the index at which to begin the iteration.
Returns:
a list iterator over this list.
Throws:
IndexOutOfBoundsException - if index does not denote a valid iteration position (valid: 0 - size()).

removeElementAt

public boolean removeElementAt(int index)
Removes the element at a specified index in this list. All elements following the removed element are pushed to their predecessor's indices.

Parameters:
index - the index of the element to remove.
Returns:
the value of the element removed.
Throws:
UnsupportedOperationException - if the operation is not supported by this list.
IndexOutOfBoundsException - if index does not denote a valid element position (valid: 0 - size()-1).

set

public boolean set(int index,
                   boolean v)
Sets a specified element to a new value.

Parameters:
index - the index of the element whose value to set.
v - the new value of the specified element.
Returns:
the previous value of the element.
Throws:
UnsupportedOperationException - if the operation is not supported by this list.
IndexOutOfBoundsException - if index does not denote a valid element position (valid: 0 - size()-1).

PCJ API
Version 1.2

Report a bug or request a feature.
Further information on the development and latest release of PCJ can be found at the project homepage.

Primitive Collections for Java is released under the GNU Lesser General Public License.
Copyright © 2002, 2003 Søren Bak. All Rights Reserved.

Hosted by SourceForge.net
SourceForge.net Logo