byte primitives, that are not already found in
either Byte or Arrays, and interpret bytes as neither signed nor unsigned.
The methods which specifically treat bytes as signed or unsigned are found in SignedBytes
and UnsignedBytes.
See the Guava User Guide article on primitive utilities.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static List | Returns: a list view of the arraythe array to back the list backingArray)Returns a fixed-size list backed by the specified array, similar to |
| public static byte[] | Returns: a single array containing all the values from the source arrays, in orderzero or more arrays)byte arraysReturns the values from each provided array combined into a single array. |
| public static boolean | Returns: true if array[i] == target for some value of ian array of array, byte byte values, possibly emptya primitive target)byte valueReturns |
| public static byte[] | Returns: an array containing the values ofarray, with guaranteed minimum length minLengththe source array array, int the minimum length the returned array must guarantee minLength, int an extra amount to "grow" the array by if growth is necessary padding)Returns an array containing the same values as |
| public static int | Returns: a hash code for the valuea primitive value)byte valueReturns a hash code for |
| public static int | Returns: the least indexi for which array[i] == target, or -1 if no
such index exists.an array of array, byte byte values, possibly emptya primitive target)byte valueReturns the index of the first appearance of the value |
| private static int | |
| public static int | indexOf(byte[]
the array to search for the sequence array, byte[] targetthe array to search for as a sub-sequence of target)arrayReturns the start position of the first occurrence of the specified |
| public static int | Returns: the greatest indexi for which array[i] == target, or -1 if no
such index exists.an array of array, byte byte values, possibly emptya primitive target)byte valueReturns the index of the last appearance of the value |
| private static int | |
| public static void | |
| public static void | reverse(byte[] array, int fromIndex, int toIndex)
Reverses the elements of |
| public static void | rotate(byte[] array, int distance)
Performs a right rotation of |
| public static void | rotate(byte[] array, int distance, int fromIndex, int toIndex)
Performs a right rotation of |
| public static byte[] | Returns: an array containing the same values ascollection, in the same order, converted
to primitivesa collection of collection)Number instancesReturns an array containing each value of |
| Bytes | back to summary |
|---|---|
| private Bytes() | |
| asList | back to summary |
|---|---|
| public static List Returns a fixed-size list backed by the specified array, similar to The returned list maintains the values, but not the identities, of The returned list is serializable. | |
| concat | back to summary |
|---|---|
| public static byte[] concat(byte[]... arrays) Returns the values from each provided array combined into a single array. For example,
| |
| contains | back to summary |
|---|---|
| public static boolean contains(byte[] array, byte target) Returns
| |
| ensureCapacity | back to summary |
|---|---|
| public static byte[] ensureCapacity(byte[] array, int minLength, int padding) Returns an array containing the same values as
| |
| hashCode | back to summary |
|---|---|
| public static int hashCode(byte value) Returns a hash code for Java 8+ users: use
| |
| indexOf | back to summary |
|---|---|
| public static int indexOf(byte[] array, byte target) Returns the index of the first appearance of the value
| |
| indexOf | back to summary |
|---|---|
| private static int indexOf(byte[] array, byte target, int start, int end) | |
| indexOf | back to summary |
|---|---|
| public static int indexOf(byte[] array, byte[] target) Returns the start position of the first occurrence of the specified More formally, returns the lowest index
| |
| lastIndexOf | back to summary |
|---|---|
| public static int lastIndexOf(byte[] array, byte target) Returns the index of the last appearance of the value
| |
| lastIndexOf | back to summary |
|---|---|
| private static int lastIndexOf(byte[] array, byte target, int start, int end) | |
| reverse | back to summary |
|---|---|
| public static void reverse(byte[] array) Reverses the elements of
| |
| reverse | back to summary |
|---|---|
| public static void reverse(byte[] array, int fromIndex, int toIndex) Reverses the elements of
| |
| rotate | back to summary |
|---|---|
| public static void rotate(byte[] array, int distance) Performs a right rotation of The provided "distance" may be negative, which will rotate left.
| |
| rotate | back to summary |
|---|---|
| public static void rotate(byte[] array, int distance, int fromIndex, int toIndex) Performs a right rotation of The provided "distance" may be negative, which will rotate left.
| |
| toArray | back to summary |
|---|---|
| public static byte[] toArray(Collection<? extends Number> collection) Returns an array containing each value of Elements are copied from the argument collection as if by
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final byte[] | |
| pack-priv final int | |
| private static final long | |
| pack-priv final int |
| Access | Constructor and Description |
|---|---|
| pack-priv | |
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | contains(Object
element whose presence in this list is to be tested target)Overrides java. Implements java. true if this list contains the specified element.
|
| public boolean | equals(Object
the object to be compared for equality with this list object)Overrides java. Implements java. |
| public Byte | get(int
index of the element to return index)Implements abstract java. Implements java. |
| public int | hashCode()
Overrides java. Implements java. |
| public int | indexOf(Object
element to search for target)Overrides java. Implements java. |
| public boolean | isEmpty()
Overrides java. Implements java. true if this list contains no elements.
|
| public int | lastIndexOf(Object
element to search for target)Overrides java. Implements java. |
| public Byte | set(int
index of the element to replace index, Byte element to be stored at the specified position element)Overrides java. Implements java. |
| public int | size()
Implements abstract java. Implements java. |
| public List | subList(int
low endpoint (inclusive) of the subList fromIndex, int high endpoint (exclusive) of the subList toIndex)Overrides java. Implements java. fromIndex, inclusive, and toIndex, exclusive.
|
| pack-priv byte[] | |
| public String | toString()
Overrides java. |
| array | back to summary |
|---|---|
| pack-priv final byte[] array | |
| end | back to summary |
|---|---|
| pack-priv final int end | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| start | back to summary |
|---|---|
| pack-priv final int start | |
| ByteArrayAsList | back to summary |
|---|---|
| pack-priv ByteArrayAsList(byte[] array) | |
| ByteArrayAsList | back to summary |
|---|---|
| pack-priv ByteArrayAsList(byte[] array, int start, int end) | |
| contains | back to summary |
|---|---|
| public boolean contains(Object target) Overrides java. Implements java. Doc from java. Returns | |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Implements java. Doc from java. Compares the specified object with this list for equality. Returns
| |
| get | back to summary |
|---|---|
| public Byte get(int index) Implements abstract java. Implements java. Doc from java. Returns the element at the specified position in this list.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Implements java. Doc from java. Returns the hash code value for this list.
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(Object target) Overrides java. Implements java. Doc from java. Returns the index of the first occurrence of the specified element
in this list, or -1 if this list does not contain the element.
More formally, returns the lowest index
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Overrides java. Implements java. Doc from java. Returns
| |
| lastIndexOf | back to summary |
|---|---|
| public int lastIndexOf(Object target) Overrides java. Implements java. Doc from java. Returns the index of the last occurrence of the specified element
in this list, or -1 if this list does not contain the element.
More formally, returns the highest index
| |
| set | back to summary |
|---|---|
| public Byte set(int index, Byte element) Overrides java. Implements java. Doc from java. Replaces the element at the specified position in this list with the specified element (optional operation).
| |
| size | back to summary |
|---|---|
| public int size() Implements abstract java. Implements java. Doc from java. Returns the number of elements in this list. If this list contains
more than
| |
| subList | back to summary |
|---|---|
| public List Overrides java. Implements java. Doc from java. Returns a view of the portion of this list between the specified
This method eliminates the need for explicit range operations (of the sort that commonly exist for arrays). Any operation that expects a list can be used as a range operation by passing a subList view instead of a whole list. For example, the following idiom removes a range of elements from a list:
Similar idioms may be constructed for indexOf and
lastIndexOf, and all of the algorithms in the
Collections class can be applied to a subList.The semantics of the list returned by this method become undefined if the backing list (i.e., this list) is structurally modified in any way other than via the returned list. (Structural modifications are those that change the size of this list, or otherwise perturb it in such a fashion that iterations in progress may yield incorrect results.)
| |
| toByteArray | back to summary |
|---|---|
| pack-priv byte[] toByteArray() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of this collection. The string
representation consists of a list of the collection's elements in the
order they are returned by its iterator, enclosed in square brackets
( | |