public class FloatGapList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Note that this implementation is not synchronized.
List,
ArrayList,
LinkedList,
Serialized Form| Constructor and Description |
|---|
FloatGapList()
Default constructor.
|
FloatGapList(java.util.Collection<java.lang.Float> that)
Copy constructor.
|
FloatGapList(int capacity)
Construct a vector with given capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(float elem) |
void |
add(int index,
float elem) |
boolean |
addAll(java.util.Collection<java.lang.Float> coll)
Adds all of the elements in the specified collection into this list.
|
boolean |
addAll(float... elems)
Adds all specified elements into this list.
|
boolean |
addAll(FloatGapList list)
Adds all of the elements in the specified list into this list.
|
boolean |
addAll(int index,
java.util.Collection<java.lang.Float> coll)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
boolean |
addAll(int index,
float... elems)
Inserts the specified elements into this list,
starting at the specified position.
|
boolean |
addAll(int index,
FloatGapList list)
Inserts all of the elements in the specified list into this
list, starting at the specified position.
|
void |
addFirst(float elem) |
void |
addLast(float elem) |
int |
binarySearch(float key)
Searches the specified range for an object using the binary
search algorithm.
|
int |
binarySearch(int index,
int len,
float key)
Searches the specified range for an object using the binary
search algorithm.
|
int |
capacity()
Returns capacity of this FloatGapList.
|
void |
clear() |
java.lang.Object |
clone()
Returns a shallow copy of this FloatGapList instance
(The elements themselves are not copied).
|
boolean |
contains(float elem) |
boolean |
containsAll(java.util.Collection<java.lang.Float> coll) |
boolean |
containsAny(java.util.Collection<java.lang.Float> coll)
Returns true if any of the elements of the specified collection is contained in the list.
|
FloatGapList |
copy()
Returns a shallow copy of this FloatGapList instance
(the new list will contain the same elements as the source list, i.e. the elements themselves are not copied).
|
static void |
copy(FloatGapList src,
int srcIndex,
FloatGapList dst,
int dstIndex,
int len)
Copies elements from one FloatGapList to another.
|
void |
copy(int srcIndex,
int dstIndex,
int len)
Copy specified elements.
|
static FloatGapList |
create()
Create new list.
|
static FloatGapList |
create(float... elems)
Create new list and add multiple elements to list.
|
float |
element() |
static FloatGapList |
EMPTY() |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this FloatGapList instance, if
necessary, to ensure that it can hold at least the number of elements
specified by the minimum capacity argument.
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
void |
fill(float elem)
Fill list.
|
void |
fill(int index,
int len,
float elem)
Fill specified elements.
|
float |
get(int index) |
FloatGapList |
get(int index,
int len)
Returns specified range of elements from list.
|
float[] |
getArray(int index,
int len)
Returns specified range of elements from list.
|
float |
getFirst() |
float |
getLast() |
int |
hashCode()
Returns a hash code value for the object.
|
int |
indexOf(float elem) |
void |
init(int len,
float elem)
Initializes the list so it will afterwards have a size of
len and contain only the element elem. |
boolean |
isEmpty() |
int |
lastIndexOf(float elem) |
static void |
move(FloatGapList src,
int srcIndex,
FloatGapList dst,
int dstIndex,
int len)
Moves elements from one FloatGapList to another.
|
void |
move(int srcIndex,
int dstIndex,
int len)
Move specified elements.
|
boolean |
offer(float elem) |
boolean |
offerFirst(float elem) |
boolean |
offerLast(float elem) |
float |
peek() |
float |
peekFirst() |
float |
peekLast() |
float |
poll() |
float |
pollFirst() |
float |
pollLast() |
float |
pop() |
void |
push(float elem) |
float |
remove() |
float |
remove(int index) |
void |
remove(int index,
int len)
Remove specified range of elements from list.
|
boolean |
removeAll(java.util.Collection<java.lang.Float> coll) |
boolean |
removeAll(FloatGapList coll) |
float |
removeFirst() |
boolean |
removeFirstOccurrence(float elem) |
float |
removeLast() |
boolean |
removeLastOccurrence(float elem) |
void |
resize(int len,
float elem)
Resizes the list so it will afterwards have a size of
len. |
boolean |
retainAll(java.util.Collection<java.lang.Float> coll) |
boolean |
retainAll(FloatGapList coll) |
void |
reverse()
Reverses the order of all elements in the specified list.
|
void |
reverse(int index,
int len)
Reverses the order of the specified elements in the list.
|
void |
rotate(int distance)
Rotate specified elements in the list.
|
void |
rotate(int index,
int len,
int distance)
Rotate specified elements in the list.
|
float |
set(int index,
float elem) |
void |
setAll(int index,
java.util.Collection<java.lang.Float> coll)
Replaces the specified elements.
|
void |
setAll(int index,
float... elems)
Replaces the specified elements.
|
void |
setAll(int index,
FloatGapList list)
Replaces the specified elements.
|
int |
size() |
void |
sort()
Sort elements in the list using the specified comparator.
|
void |
sort(int index,
int len)
Sort specified elements in the list using the specified comparator.
|
static void |
swap(FloatGapList src,
int srcIndex,
FloatGapList dst,
int dstIndex,
int len)
Swaps elements from two GapLists.
|
void |
swap(int index1,
int index2,
int len)
Swap the specified elements in the list.
|
float[] |
toArray() |
float[] |
toArray(float[] array) |
float[] |
toArray(int index,
int len)
Returns an array containing the specified elements in this list.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
void |
trimToSize()
Trims the capacity of this FloatGapList instance to be the
list's current size.
|
FloatGapList |
unmodifiableList()
Returns an unmodifiable view of this list.
|
public FloatGapList()
public FloatGapList(int capacity)
capacity - capacity to usepublic FloatGapList(java.util.Collection<java.lang.Float> that)
that - source object to copypublic static FloatGapList EMPTY()
public static FloatGapList create()
type - of elements stored in the listpublic static FloatGapList create(float... elems)
elems - elements to addtype - of elements stored in the listpublic FloatGapList copy()
clone()public FloatGapList unmodifiableList()
public java.lang.Object clone()
clone in class java.lang.ObjectCloneablepublic void clear()
public int size()
public int capacity()
public float get(int index)
public float set(int index,
float elem)
public boolean add(float elem)
public void add(int index,
float elem)
public float remove(int index)
public void ensureCapacity(int minCapacity)
minCapacity - the desired minimum capacitypublic void trimToSize()
public boolean equals(java.lang.Object obj)
java.lang.Object
The equals method implements an equivalence relation
on non-null object references:
x, x.equals(x) should return
true.
x and y, x.equals(y)
should return true if and only if
y.equals(x) returns true.
x, y, and z, if
x.equals(y) returns true and
y.equals(z) returns true, then
x.equals(z) should return true.
x and y, multiple invocations of
x.equals(y) consistently return true
or consistently return false, provided no
information used in equals comparisons on the
objects is modified.
x,
x.equals(null) should return false.
The equals method for class Object implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x and
y, this method returns true if and only
if x and y refer to the same object
(x == y has the value true).
Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes.
equals in class java.lang.Objectobj - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.Object.hashCode(),
Hashtablepublic int hashCode()
java.lang.Objectjava.util.Hashtable.
The general contract of hashCode is:
hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
hashCode in class java.lang.ObjectObject.equals(java.lang.Object),
Hashtablepublic java.lang.String toString()
java.lang.ObjecttoString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString in class java.lang.Objectpublic boolean isEmpty()
public int indexOf(float elem)
public int lastIndexOf(float elem)
public boolean contains(float elem)
public boolean containsAny(java.util.Collection<java.lang.Float> coll)
coll - collection with elements to be containedpublic boolean containsAll(java.util.Collection<java.lang.Float> coll)
public boolean removeAll(java.util.Collection<java.lang.Float> coll)
public boolean removeAll(FloatGapList coll)
removeAll(Collection)public boolean retainAll(java.util.Collection<java.lang.Float> coll)
public boolean retainAll(FloatGapList coll)
retainAll(Collection)public float[] toArray()
public float[] toArray(int index,
int len)
index - index of first element to copylen - number of elements to copypublic float[] toArray(float[] array)
public boolean addAll(java.util.Collection<java.lang.Float> coll)
coll - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified collection is (float)0public boolean addAll(int index,
java.util.Collection<java.lang.Float> coll)
index - index at which to insert the first element from the
specified collectioncoll - collection containing elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.NullPointerException - if the specified collection is (float)0public boolean addAll(float... elems)
elems - elements to be added to this listpublic boolean addAll(int index,
float... elems)
index - index at which to insert the first element from the
specified collectionelems - elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidpublic boolean addAll(FloatGapList list)
list - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified list is (float)0public boolean addAll(int index,
FloatGapList list)
index - index at which to insert the first element from the
specified collectionlist - list containing elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.NullPointerException - if the specified collection is (float)0public float getFirst()
public float getLast()
public void addFirst(float elem)
public void addLast(float elem)
public float removeFirst()
public float removeLast()
public float peek()
public float element()
public float poll()
public float remove()
public boolean offer(float elem)
public boolean offerFirst(float elem)
public boolean offerLast(float elem)
public float peekFirst()
public float peekLast()
public float pollFirst()
public float pollLast()
public float pop()
public void push(float elem)
public boolean removeFirstOccurrence(float elem)
public boolean removeLastOccurrence(float elem)
public static void move(FloatGapList src, int srcIndex, FloatGapList dst, int dstIndex, int len)
src - source listsrcIndex - index of first element in source listdst - destination listdstIndex - index of first element in source listlen - number of elements to movetype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void copy(FloatGapList src, int srcIndex, FloatGapList dst, int dstIndex, int len)
src - source listsrcIndex - index of first element in source listdst - destination listdstIndex - index of first element in source listlen - number of elements to copytype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void swap(FloatGapList src, int srcIndex, FloatGapList dst, int dstIndex, int len)
src - first listsrcIndex - index of first element in first listdst - second listdstIndex - index of first element in second listlen - number of elements to swaptype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic FloatGapList get(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic float[] getArray(int index,
int len)
index - index of first element to retrievelen - number of elements to retrievepublic void setAll(int index,
FloatGapList list)
index - index of first element to setlist - list with elements to setpublic void setAll(int index,
java.util.Collection<java.lang.Float> coll)
index - index of first element to setcoll - collection with elements to setpublic void setAll(int index,
float... elems)
index - index of first element to setelems - elements to setpublic void remove(int index,
int len)
index - index of first element to removelen - number of elements to removepublic void init(int len,
float elem)
len and contain only the element elem.
The list will grow or shrink as needed.len - length of listelem - element which the list will containpublic void resize(int len,
float elem)
len. If the list must grow, the specified
element elem will be used for filling.len - length of listelem - element which will be used for extending the listpublic void fill(float elem)
elem - element used for fillingpublic void fill(int index,
int len,
float elem)
index - index of first element to filllen - number of elements to fillelem - element used for fillingpublic void copy(int srcIndex,
int dstIndex,
int len)
srcIndex - index of first source element to copydstIndex - index of first destination element to copylen - number of elements to copypublic void move(int srcIndex,
int dstIndex,
int len)
srcIndex - index of first source element to movedstIndex - index of first destination element to movelen - number of elements to movepublic void reverse()
public void reverse(int index,
int len)
index - index of first element to reverselen - number of elements to reversepublic void swap(int index1,
int index2,
int len)
index1 - index of first element in first range to swapindex2 - index of first element in second range to swaplen - number of elements to swapjava.lang.IndexOutOfBoundsException - if the ranges overlappublic void rotate(int distance)
distance - distance to move the elementspublic void rotate(int index,
int len,
int distance)
index - index of first element to rotatelen - number of elements to rotatedistance - distance to move the elementspublic void sort()
comparator - comparator to use for sorting
((float)0 means the elements natural ordering should be used)Arrays.sort(long[])public void sort(int index,
int len)
index - index of first element to sortlen - number of elements to sortcomparator - comparator to use for sorting
((float)0 means the elements natural ordering should be used)Arrays.sort(long[])public int binarySearch(float key)
key - the value to be searched forcomparator - the comparator by which the list is ordered.
A (float)0 value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)public int binarySearch(int index,
int len,
float key)
index - index of first element to searchlen - number of elements to searchkey - the value to be searched forcomparator - the comparator by which the list is ordered.
A (float)0 value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)