boolean primitives, that are not already found in
either Boolean or Arrays.
See the Guava User Guide article on primitive utilities.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static enum | Booleans.
Comparators for |
| private static enum |
| 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 int | Returns: a positive number if onlya is true, a negative number if only b is true, or zero if a == bthe first a, boolean boolean to comparethe second b)boolean to compareCompares the two specified |
| public static boolean[] | Returns: a single array containing all the values from the source arrays, in orderzero or more arrays)boolean 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, boolean boolean values, possibly emptya primitive target)boolean valueReturns |
| public static int | |
| public static boolean[] | 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 Comparator | |
| public static int | Returns: a hash code for the valuea primitive value)boolean 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, boolean boolean values, possibly emptya primitive target)boolean valueReturns the index of the first appearance of the value |
| private static int | |
| public static int | indexOf(boolean[]
the array to search for the sequence array, boolean[] targetthe array to search for as a sub-sequence of target)arrayReturns the start position of the first occurrence of the specified |
| public static String | |
| public static int | Returns: the greatest indexi for which array[i] == target, or -1 if no
such index exists.an array of array, boolean boolean values, possibly emptya primitive target)boolean valueReturns the index of the last appearance of the value |
| private static int | |
| public static Comparator | |
| public static void | |
| public static void | reverse(boolean[] array, int fromIndex, int toIndex)
Reverses the elements of |
| public static void | rotate(boolean[] array, int distance)
Performs a right rotation of |
| public static void | rotate(boolean[] array, int distance, int fromIndex, int toIndex)
Performs a right rotation of |
| public static boolean[] | Returns: an array containing the same values ascollection, in the same order, converted
to primitivesa collection of collection)Boolean objectsCopies a collection of |
| public static Comparator |
| Booleans | back to summary |
|---|---|
| private Booleans() | |
| asList | back to summary |
|---|---|
| public static List Returns a fixed-size list backed by the specified array, similar to There are at most two distinct objects in this list, The returned list is serializable. | |
| compare | back to summary |
|---|---|
| public static int compare(boolean a, boolean b) Compares the two specified Java 7+ users: this method should be treated as deprecated; use the equivalent
| |
| concat | back to summary |
|---|---|
| public static boolean[] concat(boolean[]... arrays) Returns the values from each provided array combined into a single array. For example,
| |
| contains | back to summary |
|---|---|
| public static boolean contains(boolean[] array, boolean target) Returns Note consider representing the array as a
| |
| countTrue | back to summary |
|---|---|
| public static int countTrue(boolean... values) Returns the number of
| |
| ensureCapacity | back to summary |
|---|---|
| public static boolean[] ensureCapacity(boolean[] array, int minLength, int padding) Returns an array containing the same values as
| |
| falseFirst | back to summary |
|---|---|
| public static Comparator Returns a This is particularly useful in Java 8+ in combination with
| |
| hashCode | back to summary |
|---|---|
| public static int hashCode(boolean value) Returns a hash code for Java 8+ users: use
| |
| indexOf | back to summary |
|---|---|
| public static int indexOf(boolean[] array, boolean target) Returns the index of the first appearance of the value Note consider representing the array as a
| |
| indexOf | back to summary |
|---|---|
| private static int indexOf(boolean[] array, boolean target, int start, int end) | |
| indexOf | back to summary |
|---|---|
| public static int indexOf(boolean[] array, boolean[] target) Returns the start position of the first occurrence of the specified More formally, returns the lowest index
| |
| join | back to summary |
|---|---|
| public static String join(String separator, boolean... array) Returns a string containing the supplied
| |
| lastIndexOf | back to summary |
|---|---|
| public static int lastIndexOf(boolean[] array, boolean target) Returns the index of the last appearance of the value
| |
| lastIndexOf | back to summary |
|---|---|
| private static int lastIndexOf(boolean[] array, boolean target, int start, int end) | |
| lexicographicalComparator | back to summary |
|---|---|
| public static Comparator Returns a comparator that compares two The returned comparator is inconsistent with
| |
| reverse | back to summary |
|---|---|
| public static void reverse(boolean[] array) Reverses the elements of
| |
| reverse | back to summary |
|---|---|
| public static void reverse(boolean[] array, int fromIndex, int toIndex) Reverses the elements of
| |
| rotate | back to summary |
|---|---|
| public static void rotate(boolean[] 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(boolean[] 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 boolean[] toArray(Collection<Boolean> collection) Copies a collection of Elements are copied from the argument collection as if by Note consider representing the collection as a
| |
| trueFirst | back to summary |
|---|---|
| public static Comparator Returns a This is particularly useful in Java 8+ in combination with
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final boolean[] | |
| 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 Boolean | 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 Boolean | set(int
index of the element to replace index, Boolean 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 boolean[] | |
| public String | toString()
Overrides java. |
| array | back to summary |
|---|---|
| pack-priv final boolean[] 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 | |
| BooleanArrayAsList | back to summary |
|---|---|
| pack-priv BooleanArrayAsList(boolean[] array) | |
| BooleanArrayAsList | back to summary |
|---|---|
| pack-priv BooleanArrayAsList(boolean[] 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 Boolean 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 Boolean set(int index, Boolean 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.)
| |
| toBooleanArray | back to summary |
|---|---|
| pack-priv boolean[] toBooleanArray() | |
| 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
( | |
Boolean values.
| Modifier and Type | Field and Description |
|---|---|
| public static final Booleans. | |
| private final String | |
| public static final Booleans. | |
| private final int |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(Boolean
the first object to be compared. a, Boolean the second object to be compared. b)Implements java. |
| public String | toString()
Overrides java. |
| public static Booleans. | |
| public static Booleans. |
| FALSE_FIRST | back to summary |
|---|---|
| public static final Booleans. | |
| toString | back to summary |
|---|---|
| private final String toString | |
| TRUE_FIRST | back to summary |
|---|---|
| public static final Booleans. | |
| trueValue | back to summary |
|---|---|
| private final int trueValue | |
| BooleanComparator | back to summary |
|---|---|
| private BooleanComparator(int trueValue, String toString) | |
| compare | back to summary |
|---|---|
| public int compare(Boolean a, Boolean b) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists. | |
| valueOf | back to summary |
|---|---|
| public static Booleans. | |
| values | back to summary |
|---|---|
| public static Booleans. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Booleans. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(boolean[]
the first object to be compared. left, boolean[] the second object to be compared. right)Implements java. |
| public String | toString()
Overrides java. |
| public static Booleans. | |
| public static Booleans. |
| INSTANCE | back to summary |
|---|---|
| public static final Booleans. | |
| LexicographicalComparator | back to summary |
|---|---|
| private LexicographicalComparator() | |
| compare | back to summary |
|---|---|
| public int compare(boolean[] left, boolean[] right) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists. | |
| valueOf | back to summary |
|---|---|
| public static Booleans. | |
| values | back to summary |
|---|---|
| public static Booleans. | |