public class Objects extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
BAR0_STRING
Deprecated.
As of release 6.0.0, not worth to have this API.
|
static String |
BAR1_STRING
Deprecated.
As of release 6.0.0, not worth to have this API.
|
static String |
BAR2_STRING
Deprecated.
As of release 6.0.0, not worth to have this API.
|
static Character |
NULL_CHARACTER
The null character.
|
static char |
PATH_SEPARATOR_CHAR
Deprecated.
As of release 6.0.0, never used and confusing.
|
static String |
PATH_SEPARATOR_STRING
Deprecated.
As of release 6.0.0, never used and confusing.
|
static Object |
UNKNOWN
Denotes unknown.
|
static BigDecimal |
ZERO_BIG_DECIMAL
Represents 0 in big decimal.
|
static BigInteger |
ZERO_BIG_INTEGER
Represents 0 in big integer.
|
static Byte |
ZERO_BYTE
The zero integer.
|
static Double |
ZERO_DOUBLE
The zero double.
|
static Float |
ZERO_FLOAT
The zero float.
|
static Integer |
ZERO_INTEGER
The zero integer.
|
static Long |
ZERO_LONG
The zero long.
|
static Short |
ZERO_SHORT
The zero short.
|
| Constructor and Description |
|---|
Objects() |
| Modifier and Type | Method and Description |
|---|---|
static Object |
clone(Object o)
Clones the specified object.
|
static boolean |
equals(Object a,
Object b)
Tests whether two objects are equals.
|
static int |
hashCode(boolean[] v)
Generates hash codes for an array of boolean.
|
static int |
hashCode(byte[] v)
Generates hash codes for an array of bytes.
|
static int |
hashCode(byte[] v,
int len)
Generates hash codes for an array of bytes up to the specified length.
|
static int |
hashCode(char[] v)
Generates hash codes for an array.
|
static int |
hashCode(int[] v)
Generates hash codes for an array.
|
static int |
hashCode(long[] v)
Generates hash codes for an array.
|
static int |
hashCode(Object o)
Returns the object's hash code, or zero if null.
|
static int |
hashCode(short[] v)
Generates hash codes for an array.
|
static int |
nextHashCode(int prevHashVal,
int newVal)
Returns the next hash value by giving the previous one and a new one.
|
static byte[] |
toByteArray(byte v)
Converts a byte to a big-endian byte array.
|
static byte[] |
toByteArray(int v)
Converts an integer to a big-endian byte array.
|
static byte[] |
toByteArray(long v)
Converts a long to a big-endian byte array.
|
static byte[] |
toByteArray(short v)
Converts a short to a big-endian byte array.
|
static char[] |
toCharArray(Object o)
Converts any object to a character array.
|
static String |
toString(Object o)
Converts any object to a string.
|
public static final Object UNKNOWN
public static final Long ZERO_LONG
public static final Integer ZERO_INTEGER
public static final Short ZERO_SHORT
public static final Byte ZERO_BYTE
public static final Float ZERO_FLOAT
public static final Double ZERO_DOUBLE
public static final BigDecimal ZERO_BIG_DECIMAL
BigDecimals.ZERO.BigDecimals.ONEpublic static final BigInteger ZERO_BIG_INTEGER
BigIntegers.ZERO.public static final Character NULL_CHARACTER
public static final char PATH_SEPARATOR_CHAR
public static final String PATH_SEPARATOR_STRING
public static final String BAR0_STRING
public static final String BAR1_STRING
public static final String BAR2_STRING
public static final int nextHashCode(int prevHashVal,
int newVal)
prevHashVal - the previous hash value returned by this method; 0
if it is the first call.newVal - the new value to put inpublic static final int hashCode(boolean[] v)
v - the arraypublic static final int hashCode(byte[] v)
v - the arraypublic static final int hashCode(byte[] v,
int len)
v - the arraylen - the maximal length to generate hashCodepublic static final int hashCode(char[] v)
v - the arraypublic static final int hashCode(short[] v)
v - the arraypublic static final int hashCode(int[] v)
v - the byte arraypublic static final int hashCode(long[] v)
v - the arraypublic static final int hashCode(Object o)
public static final boolean equals(Object a, Object b)
It takes care of the null case. Thus, it is helpful to implement Object.equals.
Notice: it uses compareTo if BigDecimal is found. So, in this case, a.equals(b) might not be the same as Objects.equals(a, b).
If both a and b are Object[], they are compared item-by-item.
public static final char[] toCharArray(Object o)
o - the object to convertpublic static final String toString(Object o)
ArraysX.toString(java.lang.Object[])
to make the string more readable.public static final byte[] toByteArray(int v)
public static final byte[] toByteArray(long v)
public static final byte[] toByteArray(short v)
public static final byte[] toByteArray(byte v)
public static final Object clone(Object o)
If o is null, null is returned.
SystemException - if failed to cloneCopyright © 2018. All rights reserved.