float primitives, that are not already found in
either Float or Arrays.
See the Guava User Guide article on primitive utilities.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private static class | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | BYTES
The number of bytes required to represent a primitive |
| 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: the result of invokingFloat#compare(float, float)the first a, float float to comparethe second b)float to compareCompares the two specified |
| public static float[] | Returns: a single array containing all the values from the source arrays, in orderzero or more arrays)float arraysReturns the values from each provided array combined into a single array. |
| public static float | constrainToRange(float
the value, float float value to constrainthe lower bound (inclusive) of the range to constrain min, float value tothe upper bound (inclusive) of the range to constrain max)value toReturns the value nearest to |
| public static boolean | Returns: true if array[i] == target for some value of ian array of array, float float values, possibly emptya primitive target)float valueReturns |
| public static float[] | 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)float 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, float float values, possibly emptya primitive target)float valueReturns the index of the first appearance of the value |
| private static int | |
| public static int | indexOf(float[]
the array to search for the sequence array, float[] targetthe array to search for as a sub-sequence of target)arrayReturns the start position of the first occurrence of the specified |
| public static boolean | |
| public static String | join(String
the text that should appear between consecutive values in the resulting string
(but not at the start or end) separator, float... an array of array)float values, possibly emptyReturns a string containing the supplied |
| public static int | Returns: the greatest indexi for which array[i] == target, or -1 if no
such index exists.an array of array, float float values, possibly emptya primitive target)float valueReturns the index of the last appearance of the value |
| private static int | |
| public static Comparator | |
| public static float | Returns: the value present inarray that is greater than or equal to every other value
in the arraya nonempty array of array)float valuesReturns the greatest value present in |
| public static float | Returns: the value present inarray that is less than or equal to every other value in
the arraya nonempty array of array)float valuesReturns the least value present in |
| public static void | |
| public static void | reverse(float[] array, int fromIndex, int toIndex)
Reverses the elements of |
| public static void | rotate(float[] array, int distance)
Performs a right rotation of |
| public static void | rotate(float[] array, int distance, int fromIndex, int toIndex)
Performs a right rotation of |
| public static void | |
| public static void | sortDescending(float[] array, int fromIndex, int toIndex)
Sorts the elements of |
| public static Converter | stringConverter()
Returns a serializable converter object that converts between strings and floats using |
| public static float[] | 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 |
| public static Float |
| BYTES | back to summary |
|---|---|
| public static final int BYTES The number of bytes required to represent a primitive Java 8 users: use
| |
| Floats | back to summary |
|---|---|
| private Floats() | |
| 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 may have unexpected behavior if it contains The returned list is serializable. | |
| compare | back to summary |
|---|---|
| public static int compare(float a, float b) Compares the two specified Note this method simply delegates to the JDK method
| |
| concat | back to summary |
|---|---|
| public static float[] concat(float[]... arrays) Returns the values from each provided array combined into a single array. For example,
| |
| constrainToRange | back to summary |
|---|---|
| public static float constrainToRange(float value, float min, float max) Returns the value nearest to If
| |
| contains | back to summary |
|---|---|
| public static boolean contains(float[] array, float target) Returns
| |
| ensureCapacity | back to summary |
|---|---|
| public static float[] ensureCapacity(float[] array, int minLength, int padding) Returns an array containing the same values as
| |
| hashCode | back to summary |
|---|---|
| public static int hashCode(float value) Returns a hash code for Java 8 users: use
| |
| indexOf | back to summary |
|---|---|
| public static int indexOf(float[] array, float target) Returns the index of the first appearance of the value
| |
| indexOf | back to summary |
|---|---|
| private static int indexOf(float[] array, float target, int start, int end) | |
| indexOf | back to summary |
|---|---|
| public static int indexOf(float[] array, float[] target) Returns the start position of the first occurrence of the specified More formally, returns the lowest index Note that this always returns
| |
| isFinite | back to summary |
|---|---|
| public static boolean isFinite(float value) Returns Java 8 users: use
| |
| join | back to summary |
|---|---|
| public static String join(String separator, float... array) Returns a string containing the supplied Note that
| |
| lastIndexOf | back to summary |
|---|---|
| public static int lastIndexOf(float[] array, float target) Returns the index of the last appearance of the value
| |
| lastIndexOf | back to summary |
|---|---|
| private static int lastIndexOf(float[] array, float target, int start, int end) | |
| lexicographicalComparator | back to summary |
|---|---|
| public static Comparator Returns a comparator that compares two The returned comparator is inconsistent with
| |
| max | back to summary |
|---|---|
| public static float max(float... array) Returns the greatest value present in
| |
| min | back to summary |
|---|---|
| public static float min(float... array) Returns the least value present in
| |
| reverse | back to summary |
|---|---|
| public static void reverse(float[] array) Reverses the elements of
| |
| reverse | back to summary |
|---|---|
| public static void reverse(float[] array, int fromIndex, int toIndex) Reverses the elements of
| |
| rotate | back to summary |
|---|---|
| public static void rotate(float[] 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(float[] array, int distance, int fromIndex, int toIndex) Performs a right rotation of The provided "distance" may be negative, which will rotate left.
| |
| sortDescending | back to summary |
|---|---|
| public static void sortDescending(float[] array) Sorts the elements of Note that this method uses the total order imposed by
| |
| sortDescending | back to summary |
|---|---|
| public static void sortDescending(float[] array, int fromIndex, int toIndex) Sorts the elements of Note that this method uses the total order imposed by
| |
| stringConverter | back to summary |
|---|---|
| public static Converter Returns a serializable converter object that converts between strings and floats using
| |
| toArray | back to summary |
|---|---|
| public static float[] toArray(Collection<? extends Number> collection) Returns an array containing each value of Elements are copied from the argument collection as if by
| |
| tryParse | back to summary |
|---|---|
| public static Float tryParse(String string) Parses the specified string as a single-precision floating point value. The ASCII character
Unlike This implementation is likely to be faster than
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final float[] | |
| 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 Float | 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 Float | set(int
index of the element to replace index, Float 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 float[] | |
| public String | toString()
Overrides java. |
| array | back to summary |
|---|---|
| pack-priv final float[] 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 | |
| FloatArrayAsList | back to summary |
|---|---|
| pack-priv FloatArrayAsList(float[] array) | |
| FloatArrayAsList | back to summary |
|---|---|
| pack-priv FloatArrayAsList(float[] 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 Float 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 Float set(int index, Float 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.)
| |
| toFloatArray | back to summary |
|---|---|
| pack-priv float[] toFloatArray() | |
| 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
( | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final Floats. | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected String | doBackward(Float
the instance to convert; will never be null value)Implements abstract com. b as an instance of type A.
|
| protected Float | doForward(String
the instance to convert; will never be null value)Implements abstract com. a as an instance of type B.
|
| private Object | |
| public String |
| INSTANCE | back to summary |
|---|---|
| pack-priv static final Floats. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| FloatConverter | back to summary |
|---|---|
| private FloatConverter() | |
| doBackward | back to summary |
|---|---|
| protected String doBackward(Float value) Implements abstract com. Doc from com. Returns a representation of | |
| doForward | back to summary |
|---|---|
| protected Float doForward(String value) Implements abstract com. Doc from com. Returns a representation of | |
| readResolve | back to summary |
|---|---|
| private Object readResolve() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Floats. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(float[]
the first object to be compared. left, float[] the second object to be compared. right)Implements java. |
| public String | toString()
Overrides java. |
| public static Floats. | |
| public static Floats. |
| INSTANCE | back to summary |
|---|---|
| public static final Floats. | |
| LexicographicalComparator | back to summary |
|---|---|
| private LexicographicalComparator() | |
| compare | back to summary |
|---|---|
| public int compare(float[] left, float[] 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 Floats. | |
| values | back to summary |
|---|---|
| public static Floats. | |