Package com.mta.tehreer.collections
Class ByteList
java.lang.Object
com.mta.tehreer.collections.ByteList
- All Implemented Interfaces:
Primitive
Represents a primitive list of bytes.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcopyTo(byte[] array, int atIndex) Copies all of the bytes in this list to an array, starting at the specified index of the target array.booleanabstract byteget(int index) Returns the byte at the specified index in this list.inthashCode()static ByteListof(byte... values) Returns a byte list whose elements are the specified values.abstract intsize()Returns the number of bytes in this list.abstract ByteListsubList(int fromIndex, int toIndex) Returns a view of the portion of this list between the specifiedfromIndex, inclusive, andtoIndex, exclusive.byte[]toArray()Returns a new array containing all of the bytes in this list in proper sequence (from first to last element).toString()
-
Constructor Details
-
ByteList
public ByteList()
-
-
Method Details
-
of
Returns a byte list whose elements are the specified values.- Parameters:
values- The elements of the byte list.- Returns:
- A new byte list.
-
size
public abstract int size()Returns the number of bytes in this list.- Returns:
- The number of bytes in this list.
-
get
public abstract byte get(int index) Returns the byte at the specified index in this list.- Parameters:
index- Index of the byte element to return.- Returns:
- The byte at the specified index in this list.
- Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= size()).
-
copyTo
public abstract void copyTo(@NonNull byte[] array, int atIndex) Copies all of the bytes in this list to an array, starting at the specified index of the target array.- Parameters:
array- The array into which the bytes of this list are to be copied.atIndex- The index in the target array at which copying begins.- Throws:
NullPointerException- ifarrayis null.IndexOutOfBoundsException- for an illegal endpoint index value (atIndex < 0 || (array.length - atIndex) < size()).
-
subList
Returns a view of the portion of this list between the specifiedfromIndex, inclusive, andtoIndex, exclusive.- Parameters:
fromIndex- Low endpoint (inclusive) of the sub list.toIndex- High endpoint (exclusive) of the sub list.- Returns:
- A view of the specified range within this list.
- Throws:
IndexOutOfBoundsException- for an illegal endpoint index value (fromIndex < 0 || toIndex > size() || fromIndex > toIndex).
-
toArray
@NonNull public byte[] toArray()Returns a new array containing all of the bytes in this list in proper sequence (from first to last element).- Returns:
- A new array containing all of the bytes in this list in proper sequence.
-
equals
-
hashCode
public int hashCode() -
toString
-