public final class Utilities extends Static
This class also provides convenience methods for computing hash code
values. All those methods expect a seed
argument, which is the hash code value computed
for previous fields in a class. For the initial seed (the one for the field for which to compute
an hash code), an arbitrary value must be provided. We suggest a different number for different
class in order to reduce the risk of collision between "empty" instances of different classes.
Serializable classes can use (int) serialVersionUID
for example.
Defined in the geotkutility
module
Modifier and Type  Field and Description 

static Version 
VERSION
The version of this Geotoolkit.org distribution.

Modifier and Type  Method and Description 

static boolean 
equals(double o1,
double o2)
Returns
true if the given doubles are equals. 
static boolean 
equals(float o1,
float o2)
Returns
true if the given floats are equals. 
static int 
hash(boolean value,
int seed)
Alters the given seed with the hash code value computed from the given value.

static int 
hash(char value,
int seed)
Alters the given seed with the hash code value computed from the given value.

static int 
hash(double value,
int seed)
Alters the given seed with the hash code value computed from the given value.

static int 
hash(float value,
int seed)
Alters the given seed with the hash code value computed from the given value.

static int 
hash(int value,
int seed)
Alters the given seed with the hash code value computed from the given value.

static int 
hash(long value,
int seed)
Alters the given seed with the hash code value computed from the given value.

static int 
hash(Object value,
int seed)
Alters the given seed with the hash code value computed from the given value.

static boolean 
listNullEquals(List l1,
List l2)
Utility method to avoid to fill an empty list during equals.

public static final Version VERSION
public static boolean equals(float o1, float o2)
true
if the given floats are equals. Positive and negative zero are
considered different, while a NaN value is considered equal to all other NaN values.o1
 The first value to compare.o2
 The second value to compare.true
if both values are equal.Float.equals(Object)
public static boolean equals(double o1, double o2)
true
if the given doubles are equals. Positive and negative zero are
considered different, while a NaN value is considered equal to all other NaN values.o1
 The first value to compare.o2
 The second value to compare.true
if both values are equal.Double.equals(Object)
public static int hash(boolean value, int seed)
value
 The value whose hash code to compute.seed
 The hash code value computed so far. If this method is invoked for the first
field, then any arbitrary value (preferably different for each class) is okay.public static int hash(char value, int seed)
value
 The value whose hash code to compute.seed
 The hash code value computed so far. If this method is invoked for the first
field, then any arbitrary value (preferably different for each class) is okay.public static int hash(int value, int seed)
byte
and short
primitive types are handled by this method as
well through implicit widening conversion.value
 The value whose hash code to compute.seed
 The hash code value computed so far. If this method is invoked for the first
field, then any arbitrary value (preferably different for each class) is okay.public static int hash(long value, int seed)
byte
and short
primitive types are handled by this method as
well through implicit widening conversion.value
 The value whose hash code to compute.seed
 The hash code value computed so far. If this method is invoked for the first
field, then any arbitrary value (preferably different for each class) is okay.public static int hash(float value, int seed)
value
 The value whose hash code to compute.seed
 The hash code value computed so far. If this method is invoked for the first
field, then any arbitrary value (preferably different for each class) is okay.public static int hash(double value, int seed)
value
 The value whose hash code to compute.seed
 The hash code value computed so far. If this method is invoked for the first
field, then any arbitrary value (preferably different for each class) is okay.public static int hash(Object value, int seed) throws AssertionError
Arrays
method or
deepHashCode
instead.
Note on assertions: There is no way to ensure at compile time that this method
is not invoked with an array argument, while doing so would usually be a program error.
Performing a systematic argument check would impose a useless overhead for correctly
implemented Object.hashCode()
methods. As a compromise we perform this check at
runtime only if assertions are enabled. Using assertions for argument check in a public
API is usually a deprecated practice, but we make an exception for this particular method.
value
 The value whose hash code to compute, or null
.seed
 The hash code value computed so far. If this method is invoked for the first
field, then any arbitrary value (preferably different for each class) is okay.AssertionError
 If assertions are enabled and the given value is an array.public static boolean listNullEquals(List l1, List l2)
l1
 first list to comparel2
 second list to compareCopyright © 2009–2017 Geotoolkit.org. All rights reserved.