Doubles is a utility class for primitive type
double. It provides
Static utility methods pertaining to double primitives, that are not already found in either Double or Arrays.
Declaration :
@GwtCompatible(emulated=true)
public final class Doubles
extends Object
Below table shows the Field summary for Guava Doubles Class :
👁 Image
Some of the methods provided by Guava Doubles Class are :
👁 Image
Exceptions :
- min : IllegalArgumentException if array is empty.
- max : IllegalArgumentException if array is empty.
- ensureCapacity : IllegalArgumentException if minLength or padding is negative.
- toArray : NullPointerException if collection or any of its elements is null.
Below table shows some other methods provided by Guava Doubles Class :
👁 Image
Below given are some examples showing the implementation of Guava Doubles Class methods :
Example 1 :
Output :
[2.6, 4.6, 1.2, 2.4, 1.5]
Example 2 :
Output :
[2.6, 4.6, 1.2, 2.4, 1.5]
Example 3 :
Output :
[2.6, 4.6, 1.2, 2.4, 1.5]
Example 4 :
output :
false
true
Example 5 :
Output :
1.2
Example 6 :