T - Specifies the type of elements in the linked list.
Remarks: The container is allocated in memory and can contain at most 9,223,372,036,854,775,807 (Long.MAX_VALUE) elements of type T.
public class LinkedList64<T> extends java.lang.Object implements IBidSequence64<T,LinkedList64.Iterator>
| Modifier and Type | Class and Description |
|---|---|
class |
LinkedList64.Iterator
Defines a bidirectional iterator that can be both
incremented and decremented.
|
class |
LinkedList64.ReverseIterator
Defines a reverse iterator that enables backward
traversal of a range.
|
class |
LinkedList64.UIterator
Defines a bidirectional iterator that can be both
incremented and decremented.
|
class |
LinkedList64.UReverseIterator
Defines a reverse unchecked iterator that enables
backward traversal of a range.
|
| Constructor and Description |
|---|
LinkedList64(java.lang.Class<T> type)
Creates an empty sequence of the specified type.
|
LinkedList64(long n,
T item)
Creates a new instance of LinkedList64 with the
specified size and initializes it with the specified element.
|
| Modifier and Type | Method and Description |
|---|---|
void |
Add(T item)
Adds an object to the end of the list.
|
void |
Assign(int n,
T item)
Erases a list and copies the specified elements
to the empty list.
|
void |
Assign(long n,
T item)
Erases a list and copies the specified elements
to the empty list.
|
void |
Assign(T item)
Erases all the elements and replaces them with
the specified value.
|
T |
Back()
Gets the last element of the list.
|
LinkedList64.Iterator |
Begin()
Returns a bidirectional iterator to the first element
in the container.
|
void |
Clear()
Erases all the elements of the list.
|
boolean |
Contains(IPredicate<T> pred)
Determines whether an element is in the sequence.
|
boolean |
Contains(T item)
Determines whether an element is in the sequence.
|
void |
CopyTo(T[] array,
int arrayIndex)
Copies the list to a compatible one-dimensional array,
starting at the specified index of the target array.
|
boolean |
Empty()
Tests if the list is empty (the size of
the list is zero).
|
LinkedList64.Iterator |
End()
Returns a bidirectional iterator to the position that is
one past the final element in the container.
|
boolean |
equals(LinkedList64<T> x)
Tests whether this instance is equal to a specified
list.
|
boolean |
equals(java.lang.Object obj)
Tests whether this instance is equal to a specified object.
|
LinkedList64.Iterator |
Erase(LinkedList64.Iterator pos)
Removes an element in a list from a specified
position.
|
LinkedList64.Iterator |
Erase(LinkedList64.Iterator first,
LinkedList64.Iterator last)
Removes a range of elements in a list from specified
positions.
|
T |
Front()
Gets the first element of the list.
|
int |
hashCode()
Returns the hash code for this instance.
|
void |
Insert(LinkedList64.Iterator pos,
int n,
T item)
Inserts a number of elements into the list at a
specified position.
|
void |
Insert(LinkedList64.Iterator pos,
long n,
T item)
Inserts a number of elements into the list at a
specified position.
|
LinkedList64.Iterator |
Insert(LinkedList64.Iterator pos,
T item)
Inserts an element into the list at a specified
position.
|
void |
Load(java.lang.String fileName)
Erases all the elements and replaces them with
the elements stored in the specified file.
|
long |
MaxSize()
Returns the maximum possible length of the list.
|
void |
Merge(LinkedList64<T> x,
IFunc2Arg<T,T,java.lang.Boolean> pred)
Merges the elements of two sorted lists.
|
boolean |
PContains(IPredicate<T> pred)
Parallel Contains: Determines whether an element is in the sequence.
|
boolean |
PContains(T item)
Parallel Contains: Determines whether an element is in the sequence.
|
void |
PCopyTo(T[] array,
int arrayIndex)
Parallel CopyTo: Copies the sequence to a compatible one-dimensional array,
starting at the specified index of the target array.
|
boolean |
PEquals(LinkedList64<T> x)
Parallel Equals: Tests whether this instance is equal to a specified
list.
|
void |
PopBack()
Deletes the element at the end of the list.
|
void |
PopFront()
Deletes the element at the beginning of the list.
|
boolean |
PRemove(IPredicate<T> pred)
Parallel Remove: Removes any occurrence of a specific object from
the sequence.
|
boolean |
PRemove(T item)
Parallel Remove: Removes the first occurrence of a specific object from
the sequence.
|
void |
PushBack(T item)
Adds an element to the end of the list.
|
void |
PushFront(T item)
Adds an element to the beginning of the list.
|
void |
Read(java.io.DataInput reader)
Loads the entire container from the specified reader.
|
boolean |
Remove(IPredicate<T> pred)
Removes the first occurrence of a specific object from
the sequence.
|
boolean |
Remove(T item)
Removes the first occurrence of a specific object from
the sequence.
|
void |
RemoveAll(IPredicate<T> pred)
Eliminates elements that satisfy a predicate from a list
without disturbing the order of the remaining elements.
|
void |
Resize(long newSize)
Specifies a new size for a list.
|
void |
Resize(long newSize,
T item)
Specifies a new size for a list.
|
void |
Reverse()
Reverses the order of the elements within a list.
|
LinkedList64.ReverseIterator |
ReverseBegin()
Returns a reverse random-access iterator to the first
element in the reversed container.
|
LinkedList64.ReverseIterator |
ReverseEnd()
Returns a reverse random-access iterator to the position
that is one past the final element in the reversed container.
|
void |
Save(java.lang.String fileName)
Saves the container elements to the specified file.
|
void |
SetBack(T value)
Sets the last element of the list.
|
void |
SetFront(T value)
Sets the first element of the list.
|
long |
Size()
Returns the number of elements in the list.
|
void |
Splice(LinkedList64.Iterator pos,
LinkedList64<T> x)
Removes elements from the argument list and inserts
them into the target list.
|
void |
Splice(LinkedList64.Iterator pos,
LinkedList64<T> x,
LinkedList64.Iterator iter)
Removes an element from the argument list and inserts
it into the target list.
|
void |
Splice(LinkedList64.Iterator pos,
LinkedList64<T> x,
LinkedList64.Iterator first,
LinkedList64.Iterator last)
Removes elements from a specified range in the argument list and
inserts them into the target list.
|
void |
Swap(LinkedList64<T> x)
Exchanges the elements of two sibling lists.
|
void |
ToStream(LinkedList64.Iterator first,
LinkedList64.Iterator last,
java.io.PrintStream sw)
Writes the elements of the current container from the
specified range to the specified stream.
|
void |
ToStream(java.io.PrintStream sw)
Writes the elements of the current container to the
specified stream.
|
java.lang.String |
toString()
Returns a string that represents the content of the
current container.
|
java.lang.String |
ToString(LinkedList64.Iterator first,
LinkedList64.Iterator last)
Returns a string that represents the elements of the
current container from the specified range.
|
java.lang.Class<T> |
Type()
Returns the type of the elements in the container.
|
LinkedList64.UIterator |
UBegin()
Returns a bidirectional iterator to the first element
in the container.
|
LinkedList64.UIterator |
UEnd()
Returns a bidirectional iterator to the position that is
one past the final element in the container.
|
void |
Unique(IFunc2Arg<T,T,java.lang.Boolean> pred)
Removes duplicate elements that are adjacent to each other
in a specified list.
|
LinkedList64.UReverseIterator |
UReverseBegin()
Returns a reverse random-access iterator to the first
element in the reversed container.
|
LinkedList64.UReverseIterator |
UReverseEnd()
Returns a reverse random-access iterator to the position
that is one past the final element in the reversed container.
|
void |
Write(java.io.DataOutput writer)
Stores the entire container to the specified writer.
|
public LinkedList64(java.lang.Class<T> type)
type - The specified type.public LinkedList64(long n,
T item)
n - The initial size of the storage.item - The element being inserted into the storage.public java.lang.Class<T> Type()
Type in interface IContainer64<T>public void Load(java.lang.String fileName)
fileName - The specified file.java.lang.RuntimeException - If an I/O error occurs.public void Save(java.lang.String fileName)
fileName - The specified file.java.lang.RuntimeException - If an I/O error occurs.public void Read(java.io.DataInput reader)
reader - The specified reader.java.lang.RuntimeException - If an I/O error occurs.public void Write(java.io.DataOutput writer)
writer - The specified writer.java.lang.RuntimeException - If an I/O error occurs.public void Assign(T item)
item - The value of the element being inserted into
the list.public void Assign(int n,
T item)
n - The number of copies of an element being
inserted into the list.item - The value of the element being inserted
into the list that must have the same data type as the list's
elements.public void Assign(long n,
T item)
n - The number of copies of an element being
inserted into the list.item - The value of the element being inserted
into the list that must have the same data type as the list's
elements.public long Size()
Size in interface IContainer64<T>public long MaxSize()
MaxSize in interface IContainer64<T>public boolean Empty()
public void Add(T item)
item - The object to be added to the end of the list.public void Clear()
Clear in interface IContainer64<T>public boolean Contains(T item)
item - The object to locate in the sequence.public boolean PContains(T item)
item - The object to locate in the sequence.public boolean Contains(IPredicate<T> pred)
pred - A user-defined predicate function that defines
the condition to be satisfied by the element being searched for.public boolean PContains(IPredicate<T> pred)
pred - A user-defined predicate function that defines
the condition to be satisfied by the element being searched for.public boolean Remove(T item)
item - The object to remove from the sequence.public boolean PRemove(T item)
item - The object to remove from the sequence.public boolean Remove(IPredicate<T> pred)
pred - A user-defined predicate function that defines
the condition to be satisfied by the element being removed.public boolean PRemove(IPredicate<T> pred)
pred - A user-defined predicate function that defines
the condition to be satisfied by the element being removed.public void CopyTo(T[] array, int arrayIndex)
array - The one-dimensional Array that is the
destination of the elements copied from list.
The Array must have zero-based indexing.arrayIndex - The zero-based index in array at
which copying begins.public void PCopyTo(T[] array, int arrayIndex)
array - The one-dimensional Array that is the
destination of the elements copied from sequence.
The Array must have zero-based indexing.arrayIndex - The zero-based index in array at
which copying begins.public LinkedList64.Iterator Begin()
Begin in interface IFwdContainer64<T,LinkedList64.Iterator>public LinkedList64.Iterator End()
End in interface IFwdContainer64<T,LinkedList64.Iterator>public LinkedList64.UIterator UBegin()
public LinkedList64.UIterator UEnd()
public LinkedList64.ReverseIterator ReverseBegin()
public LinkedList64.ReverseIterator ReverseEnd()
public LinkedList64.UReverseIterator UReverseBegin()
public LinkedList64.UReverseIterator UReverseEnd()
public T Front()
Front in interface IFrontSequence<T>java.lang.RuntimeException - When the
container is empty.public void SetFront(T value)
SetFront in interface IFrontSequence<T>value - The value to be set at the front of the sequence.java.lang.RuntimeException - When the container is empty.public T Back()
Back in interface IBackSequence<T>java.lang.RuntimeException - When the container is empty.public void SetBack(T value)
SetBack in interface IBackSequence<T>value - The value to be set at the back of the sequence.java.lang.RuntimeException - When the container is empty.public void PushBack(T item)
PushBack in interface IBackSequence<T>item - The element added to the end of the list.public void PopBack()
PopBack in interface IBackSequence<T>java.lang.RuntimeException - When the
container is empty.public void PushFront(T item)
PushFront in interface IFrontSequence<T>item - The element added to the beginning of the
list.public void PopFront()
PopFront in interface IFrontSequence<T>java.lang.RuntimeException - When the container is empty.public LinkedList64.Iterator Insert(LinkedList64.Iterator pos, T item)
Insert in interface IInsertSequence<T,LinkedList64.Iterator>pos - The position in the list where the element
is inserted.item - The value of the element being inserted
into the list.Remarks: The insertion operation is not expensive.
java.lang.RuntimeException - When the
specified iterator is invalid.public void Insert(LinkedList64.Iterator pos, int n, T item)
pos - The position in the list where the elements
are inserted.n - The number of elements being inserted into the list.item - The value of the element being inserted
into the list.
Remarks: The insertion operation is not expensive.
java.lang.RuntimeException - When the
specified iterator is invalid.public void Insert(LinkedList64.Iterator pos, long n, T item)
pos - The position in the list where the elements
are inserted.n - The number of elements being inserted into the list.item - The value of the element being inserted
into the list.
Remarks: The insertion operation is not expensive.
java.lang.RuntimeException - When the
specified iterator is invalid.public LinkedList64.Iterator Erase(LinkedList64.Iterator pos)
pos - The position of the element to be removed from
the list.java.lang.RuntimeException - When
the argument iterator is not dereferenceable.public LinkedList64.Iterator Erase(LinkedList64.Iterator first, LinkedList64.Iterator last)
first - The position of the first element removed from
the list.last - Position just beyond the last element removed
from the list.Remarks: The erase operation is not expensive.
java.lang.RuntimeException - When the
specified range is invalid.public void Resize(long newSize)
newSize - The new size of the list.
Remarks: If the new size is larger than the original size, the new objects are assigned the default value.
public void Resize(long newSize,
T item)
newSize - The new size of the list.item - The value of new elements added to the
list, if the new size is larger than the original size, that must
have the default type of the list elements.public void Swap(LinkedList64<T> x)
x - A list whose elements are to be exchanged.
Remarks: Attempting to swap non-sibling lists will throw an exception. The operation complexity is constant-time.
java.lang.RuntimeException - When the
specified list is not a sibling of the current instance.public void Splice(LinkedList64.Iterator pos, LinkedList64<T> x)
pos - The position in the target list that the elements
of the argument list are inserted before.x - The argument list that is to be inserted into
the target list.java.lang.RuntimeException - When the
specified list is not a sibling of the current instance or is the
current instance.
Remarks: After the splice operation the argument list x is empty and consequently the iterators that point to elements of x are invalid.
public void Splice(LinkedList64.Iterator pos, LinkedList64<T> x, LinkedList64.Iterator iter)
pos - The position in the target list that the specified
element from the argument list is inserted before.x - The argument list containing the element
that is to be inserted into the target list.iter - The element to be inserted from the argument
list.java.lang.RuntimeException - When the
iterator from the specified list is not dereferenceable.public void Splice(LinkedList64.Iterator pos, LinkedList64<T> x, LinkedList64.Iterator first, LinkedList64.Iterator last)
pos - The position in the target list that the elements
from a specified range of the argument list are inserted before.x - The argument list that is to be inserted into
the target list.first - The first element in the range to be inserted
from the argument list.last - The first element beyond the range to be inserted
from the argument list.java.lang.RuntimeException - When the
specified list is not a sibling of the current instance.public void RemoveAll(IPredicate<T> pred)
pred - The unary predicate that must be satisfied is the
value of an element that is to be removed.public void Unique(IFunc2Arg<T,T,java.lang.Boolean> pred)
pred - A user-defined predicate function object that defines the
condition to be satisfied if two elements are to be taken as equivalent.public void Merge(LinkedList64<T> x, IFunc2Arg<T,T,java.lang.Boolean> pred)
x - A list whose elements are to be merged.pred - A user-defined predicate function object that defines the
comparison criterion to be satisfied by successive elements in the ordering.java.lang.RuntimeException - When the
specified list is not a sibling of the current instance or is the
current instance.public void Reverse()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - An object to compare with this instance.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(LinkedList64<T> x)
x - A list to compare with this instance.Remarks: The current instance and the specified list must contain elements of the same data type.
java.lang.RuntimeException - When the specified list
contains elements of a different data type than the elements of the
current instance.public boolean PEquals(LinkedList64<T> x)
x - A list to compare with this instance.Remarks: The current instance and the specified list must contain elements of the same data type.
java.lang.RuntimeException - When the specified list
contains elements of a different data type than the elements of the
current instance.public java.lang.String toString()
toString in class java.lang.ObjectRemarks: If the container has a great number of elements this function may throw an exception. It is recommended to use the overloaded function to limit the number of elements that are dumped to a string.
public java.lang.String ToString(LinkedList64.Iterator first, LinkedList64.Iterator last)
first - An iterator addressing the position of the
first element in the range of elements.last - An iterator addressing the position that is
one past the final element in the range of elements.Remarks: If the specified range has a great number of elements this function may throw an exception.
public void ToStream(java.io.PrintStream sw)
sw - A StreamWriter object to write to.public void ToStream(LinkedList64.Iterator first, LinkedList64.Iterator last, java.io.PrintStream sw)
first - An iterator addressing the position of the
first element in the range of elements.last - An iterator addressing the position that is
one past the final element in the range of elements.sw - A StreamWriter object to write to.Copyright© 2012 Progeneric Systems, Inc. All Rights Reserved.