edu.emory.mathcs.util.collections.longs
Interface LongList

All Superinterfaces:
LongCollection
All Known Implementing Classes:
LongArrayList

public interface LongList
extends LongCollection

List of long numbers.

Version:
1.0
Author:
Dawid Kurzyniec

Method Summary
 boolean add(long e)
          Attempts to add the specified number to this collection.
 boolean addAll(int index, LongCollection c)
           
 boolean addAll(LongCollection c)
          Attempts to add to this collection all the numbers contained in the specified collection.
 void addAt(int index, long e)
          Adds the value at the specified index, and moves elements starting at index to the right.
 void clear()
          Removes all the numbers from this collection.
 boolean contains(long e)
          Returns true if this collection contains specified number; false otherwise.
 boolean containsAll(LongCollection c)
          Returns true if this collection contains all the numbers from collection c; false otherwise.
 boolean equals(java.lang.Object o)
           
 long getAt(int index)
          Returns the value at the specified index.
 int hashCode()
           
 int indexOf(long e)
          Returns the smallest index at which the list contains the specified number.
 boolean isEmpty()
          Returns true if this collection is empty; false otherwise.
 LongIterator iterator()
          Returns the iterator over numbers contained in this collection.
 int lastIndexOf(long e)
          Returns the largest index at which the list contains the specified number.
 LongListIterator listIterator()
           
 LongListIterator listIterator(int index)
           
 boolean remove(long e)
          Attempts to remove the specified number from this collection.
 boolean removeAll(LongCollection c)
          Attempts to remove from this collection all the numbers contained in the specified collection.
 long removeAt(int index)
          Removes the value at the specified index, and shifts elements starting at index+1 to the left.
 boolean retainAll(LongCollection c)
          Attempts to remove from this collection all the numbers not contained in the specified collection.
 long setAt(int index, long e)
          Sets the value at the specified index.
 int size()
          Returns the number of elements in this collection.
 LongList subList(int fromIndex, int toIndex)
           
 long[] toArray()
          Returns the newly allocated array containing all numbers from this collection, in the order returned by its iterator.
 long[] toArray(long[] a)
          Returns an array containing all of the numbers in this collection.
 
Methods inherited from interface edu.emory.mathcs.util.collections.longs.LongCollection
size64
 

Method Detail

size

public int size()
Description copied from interface: LongCollection
Returns the number of elements in this collection. If exceeds Integer.MAX_VALUE, then Integer.MAX_VALUE is returned. // PREPROC: Long,Int only

Specified by:
size in interface LongCollection

isEmpty

public boolean isEmpty()
Description copied from interface: LongCollection
Returns true if this collection is empty; false otherwise.

Specified by:
isEmpty in interface LongCollection
Returns:
true if this collection is empty; false otherwise

contains

public boolean contains(long e)
Description copied from interface: LongCollection
Returns true if this collection contains specified number; false otherwise.

Specified by:
contains in interface LongCollection
Returns:
true if this collection contains specified number; false otherwise

iterator

public LongIterator iterator()
Description copied from interface: LongCollection
Returns the iterator over numbers contained in this collection.

Specified by:
iterator in interface LongCollection
Returns:
the iterator over numbers contained in this collection.

toArray

public long[] toArray()
Description copied from interface: LongCollection
Returns the newly allocated array containing all numbers from this collection, in the order returned by its iterator.

Specified by:
toArray in interface LongCollection
Returns:
the array containing all numbers from this collection

toArray

public long[] toArray(long[] a)
Description copied from interface: LongCollection
Returns an array containing all of the numbers in this collection. If the collection fits in the specified array, it is returned therein. Otherwise, a new array is allocated.

If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.

Like the LongCollection.toArray() method, this method acts as bridge between array-based and collection-based APIs. Further, this method may, under certain circumstances, be used to save allocation costs.

Specified by:
toArray in interface LongCollection
Parameters:
a - the array into which the elements of this collection are to be stored, if it is big enough; otherwise, a new array is allocated for this purpose.
Returns:
an array containing all the elements in this collection

add

public boolean add(long e)
Description copied from interface: LongCollection
Attempts to add the specified number to this collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
add in interface LongCollection
Parameters:
e - number to be added to this collection
Returns:
true if this collection was modified as a result of this call

remove

public boolean remove(long e)
Description copied from interface: LongCollection
Attempts to remove the specified number from this collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
remove in interface LongCollection
Parameters:
e - number to be removed from this collection
Returns:
true if this collection was modified as a result of this call

containsAll

public boolean containsAll(LongCollection c)
Description copied from interface: LongCollection
Returns true if this collection contains all the numbers from collection c; false otherwise.

Specified by:
containsAll in interface LongCollection
Returns:
true if this collection contains all numbers from c; false otherwise

addAll

public boolean addAll(LongCollection c)
Description copied from interface: LongCollection
Attempts to add to this collection all the numbers contained in the specified collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
addAll in interface LongCollection
Parameters:
c - a collection of numbers to be added to this collection
Returns:
true if this collection was modified as a result of this call

addAll

public boolean addAll(int index,
                      LongCollection c)

removeAll

public boolean removeAll(LongCollection c)
Description copied from interface: LongCollection
Attempts to remove from this collection all the numbers contained in the specified collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
removeAll in interface LongCollection
Parameters:
c - a collection of numbers to be removed from this collection
Returns:
true if this collection was modified as a result of this call

retainAll

public boolean retainAll(LongCollection c)
Description copied from interface: LongCollection
Attempts to remove from this collection all the numbers not contained in the specified collection. Returns true if the collection was modified as a result of this call; false otherwise.

Specified by:
retainAll in interface LongCollection
Parameters:
c - a collection of numbers to be retained in this collection
Returns:
true if this collection was modified as a result of this call

clear

public void clear()
Description copied from interface: LongCollection
Removes all the numbers from this collection.

Specified by:
clear in interface LongCollection

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface LongCollection

hashCode

public int hashCode()
Specified by:
hashCode in interface LongCollection

getAt

public long getAt(int index)
Returns the value at the specified index.

Parameters:
index - the index to retrieve the value from.
Returns:
the value at the specified index.
Throws:
java.lang.IndexOutOfBoundsException - if index < 0 or index >= size.

setAt

public long setAt(int index,
                  long e)
Sets the value at the specified index.

Parameters:
index - the index to set the value at.
e - the new value.
Returns:
the value previously present the specified index.
Throws:
java.lang.IndexOutOfBoundsException - if index < 0 or index >= size.

addAt

public void addAt(int index,
                  long e)
Adds the value at the specified index, and moves elements starting at index to the right.

Parameters:
index - the index to add the value at.
e - the new value.
Throws:
java.lang.IndexOutOfBoundsException - if index < 0 or index > size.

removeAt

public long removeAt(int index)
Removes the value at the specified index, and shifts elements starting at index+1 to the left.

Parameters:
index - the index to remove the value from.
Returns:
the value previously present at the specified index.
Throws:
java.lang.IndexOutOfBoundsException - if index < 0 or index >= size.

indexOf

public int indexOf(long e)
Returns the smallest index at which the list contains the specified number.

Parameters:
e - the number to look for
Returns:
the smallest index of e

lastIndexOf

public int lastIndexOf(long e)
Returns the largest index at which the list contains the specified number.

Parameters:
e - the number to look for
Returns:
the largest index of e

listIterator

public LongListIterator listIterator()

listIterator

public LongListIterator listIterator(int index)

subList

public LongList subList(int fromIndex,
                        int toIndex)