E - type of elements stored in the listpublic abstract class IByteList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
List,
Deque,
ArrayList,
LinkedList,
Serialized Form| Constructor and Description |
|---|
IByteList() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(byte elem) |
void |
add(int index,
byte elem) |
boolean |
addAll(byte... elems)
Adds all specified elements into this list.
|
boolean |
addAll(java.util.Collection<java.lang.Byte> coll)
Adds all of the elements in the specified collection into this list.
|
boolean |
addAll(IByteList list)
Adds all of the elements in the specified list into this list.
|
boolean |
addAll(int index,
byte... elems)
Inserts the specified elements into this list,
starting at the specified position.
|
boolean |
addAll(int index,
java.util.Collection<java.lang.Byte> coll)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
boolean |
addAll(int index,
IByteList list)
Inserts all of the elements in the specified list into this
list, starting at the specified position.
|
void |
addFirst(byte elem) |
boolean |
addIfAbsent(byte elem)
Add elements if it is not already contained in the list.
|
void |
addLast(byte elem) |
int |
binarySearch(byte key)
Searches the specified range for an object using the binary
search algorithm.
|
abstract int |
binarySearch(int index,
int len,
byte key)
Searches the specified range for an object using the binary
search algorithm.
|
abstract int |
capacity()
Returns capacity of this list.
|
void |
clear() |
java.lang.Object |
clone()
Returns a shallow copy of this list instance.
|
boolean |
contains(byte elem) |
boolean |
containsAll(java.util.Collection<java.lang.Byte> coll) |
boolean |
containsAny(java.util.Collection<java.lang.Byte> coll)
Returns true if any of the elements of the specified collection is contained in the list.
|
IByteList |
copy()
Returns a shallow copy of this list instance.
|
static void |
copy(IByteList src,
int srcIndex,
IByteList dst,
int dstIndex,
int len)
Copies elements from one list to another.
|
void |
copy(int srcIndex,
int dstIndex,
int len)
Copy specified elements.
|
void |
drag(int srcIndex,
int dstIndex,
int len)
Drag specified elements.
|
byte |
element() |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this GapList 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.
|
IByteList |
extract(int index,
int len)
Removes specified range of elements from list and return them.
|
void |
fill(byte elem)
Fill list.
|
void |
fill(int index,
int len,
byte elem)
Fill specified elements.
|
void |
filter(Predicate<java.lang.Byte> predicate)
Filter the list using the specified predicate.
|
byte |
get(int index) |
IByteList |
getAll(byte elem)
Returns all elements in the list equal to the specified element.
|
IByteList |
getAll(int index,
int len)
Returns specified range of elements from list.
|
byte[] |
getArray(int index,
int len)
Returns specified range of elements from list as array.
|
int |
getCount(byte elem)
Counts how many times the specified element is contained in the list.
|
java.util.Set |
getDistinct()
Returns distinct elements in the list.
|
byte |
getFirst() |
byte |
getLast() |
int |
hashCode()
Returns a hash code value for the object.
|
int |
indexOf(byte elem) |
void |
init(int len,
byte elem)
Initializes the list so it will afterwards have a size of
len and contain only the element elem. |
boolean |
isEmpty() |
int |
lastIndexOf(byte elem) |
<R> IList<R> |
mappedList(Mapper<java.lang.Byte,R> mapper)
Create a new list by applying the specified mapper to all elements.
|
void |
merge(int index,
java.util.Collection<java.lang.Byte> coll)
Set or add the specified elements.
|
static void |
move(IByteList src,
int srcIndex,
IByteList dst,
int dstIndex,
int len)
Moves elements from one list to another.
|
void |
move(int srcIndex,
int dstIndex,
int len)
Move specified elements.
|
boolean |
offer(byte elem) |
boolean |
offerFirst(byte elem) |
boolean |
offerLast(byte elem) |
byte |
peek() |
byte |
peekFirst() |
byte |
peekLast() |
byte |
poll() |
byte |
pollFirst() |
byte |
pollLast() |
byte |
pop() |
void |
push(byte elem) |
byte |
remove() |
byte |
remove(int index) |
void |
remove(int index,
int len)
Remove specified range of elements from list.
|
IByteList |
removeAll(byte elem)
Removes all equal elements.
|
boolean |
removeAll(java.util.Collection<java.lang.Byte> coll) |
boolean |
removeAll(IByteList coll) |
boolean |
removeElem(byte elem) |
byte |
removeFirst() |
boolean |
removeFirstOccurrence(byte elem) |
byte |
removeLast() |
boolean |
removeLastOccurrence(byte elem) |
void |
resize(int len,
byte elem)
Resizes the list so it will afterwards have a size of
len. |
boolean |
retainAll(java.util.Collection<java.lang.Byte> coll) |
boolean |
retainAll(IByteList 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.
|
byte |
set(int index,
byte elem) |
void |
setAll(int index,
byte... elems)
Replaces the specified elements.
|
void |
setAll(int index,
java.util.Collection<java.lang.Byte> coll)
Replaces the specified elements.
|
void |
setAll(int index,
IByteList list)
Replaces the specified elements.
|
abstract int |
size() |
void |
sort()
Sort elements in the list using the specified comparator.
|
abstract void |
sort(int index,
int len)
Sort specified elements in the list using the specified comparator.
|
static void |
swap(IByteList src,
int srcIndex,
IByteList dst,
int dstIndex,
int len)
Swaps elements from two lists.
|
void |
swap(int index1,
int index2,
int len)
Swap the specified elements in the list.
|
byte[] |
toArray() |
byte[] |
toArray(byte[] array) |
byte[] |
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.
|
abstract void |
trimToSize()
An application can use this operation to minimize the storage of an instance.
|
abstract IByteList |
unmodifiableList()
Returns an unmodifiable view of this list.
|
public IByteList copy()
clone()public abstract IByteList unmodifiableList()
public java.lang.Object clone()
clone in class java.lang.ObjectCloneablepublic void clear()
public abstract int size()
public abstract int capacity()
public byte get(int index)
public byte set(int index,
byte elem)
public boolean add(byte elem)
public void add(int index,
byte elem)
public byte remove(int index)
public void ensureCapacity(int minCapacity)
minCapacity - the desired minimum capacitypublic abstract 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 getCount(byte elem)
elem - element to countpublic IByteList getAll(byte elem)
elem - element to look forpublic java.util.Set getDistinct()
public <R> IList<R> mappedList(Mapper<java.lang.Byte,R> mapper)
mapper - mapper functionpublic void filter(Predicate<java.lang.Byte> predicate)
predicate - predicate used for filteringpublic int indexOf(byte elem)
public int lastIndexOf(byte elem)
public boolean removeElem(byte elem)
public boolean contains(byte elem)
public boolean addIfAbsent(byte elem)
elem - element to addpublic boolean containsAny(java.util.Collection<java.lang.Byte> coll)
coll - collection with elements to be containedpublic boolean containsAll(java.util.Collection<java.lang.Byte> coll)
public boolean removeAll(java.util.Collection<java.lang.Byte> coll)
public IByteList removeAll(byte elem)
elem - elementpublic boolean removeAll(IByteList coll)
removeAll(Collection)public boolean retainAll(java.util.Collection<java.lang.Byte> coll)
public boolean retainAll(IByteList coll)
retainAll(Collection)public byte[] toArray()
public byte[] toArray(int index,
int len)
index - index of first element to copylen - number of elements to copypublic byte[] toArray(byte[] array)
public boolean addAll(java.util.Collection<java.lang.Byte> coll)
coll - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified collection is nullpublic boolean addAll(int index,
java.util.Collection<java.lang.Byte> 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 nullpublic boolean addAll(byte... elems)
elems - elements to be added to this listpublic boolean addAll(int index,
byte... 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(IByteList list)
list - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified list is nullpublic boolean addAll(int index,
IByteList 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 nullpublic byte peek()
public byte element()
public byte poll()
public byte remove()
public boolean offer(byte elem)
public byte getFirst()
public byte getLast()
public void addFirst(byte elem)
public void addLast(byte elem)
public byte removeFirst()
public byte removeLast()
public boolean offerFirst(byte elem)
public boolean offerLast(byte elem)
public byte peekFirst()
public byte peekLast()
public byte pollFirst()
public byte pollLast()
public byte pop()
public void push(byte elem)
public boolean removeFirstOccurrence(byte elem)
public boolean removeLastOccurrence(byte elem)
public static void move(IByteList src, int srcIndex, IByteList dst, int dstIndex, int len)
E - type of elements stored in the listsrc - source listsrcIndex - index of first element in source listdst - destination listdstIndex - index of first element in source listlen - number of elements to movejava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void copy(IByteList src, int srcIndex, IByteList dst, int dstIndex, int len)
E - type of elements stored in the listsrc - source listsrcIndex - index of first element in source listdst - destination listdstIndex - index of first element in source listlen - number of elements to copyjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void swap(IByteList src, int srcIndex, IByteList dst, int dstIndex, int len)
E - type of elements stored in the listsrc - first listsrcIndex - index of first element in first listdst - second listdstIndex - index of first element in second listlen - number of elements to swapjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic IByteList getAll(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic IByteList extract(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic byte[] getArray(int index,
int len)
index - index of first element to retrievelen - number of elements to retrievepublic void setAll(int index,
IByteList list)
index - index of first element to setlist - list with elements to setjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void setAll(int index,
java.util.Collection<java.lang.Byte> coll)
index - index of first element to setcoll - collection with elements to setpublic void merge(int index,
java.util.Collection<java.lang.Byte> coll)
index - index of first element to set or addcoll - collection with elements to set or addpublic void setAll(int index,
byte... elems)
index - index of first element to setelems - elements to setjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void remove(int index,
int len)
index - index of first element to removelen - number of elements to removejava.lang.IndexOutOfBoundsException - if the range is invalidpublic void init(int len,
byte 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 containjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void resize(int len,
byte 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 listjava.lang.IndexOutOfBoundsException - if the range is invalidpublic void fill(byte elem)
elem - element used for fillingpublic void fill(int index,
int len,
byte elem)
index - index of first element to filllen - number of elements to fillelem - element used for fillingjava.lang.IndexOutOfBoundsException - if the range is invalidpublic 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 copyjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic 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 movejava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void drag(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 movejava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void reverse()
public void reverse(int index,
int len)
index - index of first element to reverselen - number of elements to reversejava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic 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 are invalidpublic 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 elementsjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic void sort()
comparator - comparator to use for sorting
(null means the elements natural ordering should be used)Arrays.sort(long[])public abstract void sort(int index,
int len)
index - index of first element to sortlen - number of elements to sortcomparator - comparator to use for sorting
(null means the elements natural ordering should be used)java.lang.IndexOutOfBoundsException - if the range is invalidArrays.sort(long[])public int binarySearch(byte key)
key - the value to be searched forcomparator - the comparator by which the list is ordered.
A null value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)public abstract int binarySearch(int index,
int len,
byte 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 null value indicates that the elements'
natural ordering should be used.java.lang.IndexOutOfBoundsException - if the range is invalidArrays.binarySearch(long[], long)