org.fusesource.common.util
Class Objects

java.lang.Object
  extended by org.fusesource.common.util.Objects

public class Objects
extends java.lang.Object

Some helper classes for objects comparing and equality


Constructor Summary
Objects()
           
 
Method Summary
static int compare(java.lang.Comparable a, java.lang.Comparable b)
           
static
<T extends java.lang.Comparable<T>>
int
compare(java.util.List<T> a, java.util.List<T> b)
           
static boolean equal(java.lang.Object a, java.lang.Object b)
           
static int hashCode(java.lang.Object... objects)
          A helper class to create nice hash codes using a similar algorithm to Josh Bloch's Effective Java book
static void notNull(java.lang.Object value, java.lang.String name)
          Asserts whether the value is not null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Objects

public Objects()
Method Detail

hashCode

public static int hashCode(java.lang.Object... objects)
A helper class to create nice hash codes using a similar algorithm to Josh Bloch's Effective Java book


equal

public static boolean equal(java.lang.Object a,
                            java.lang.Object b)

compare

public static int compare(java.lang.Comparable a,
                          java.lang.Comparable b)

compare

public static <T extends java.lang.Comparable<T>> int compare(java.util.List<T> a,
                                                              java.util.List<T> b)

notNull

public static void notNull(java.lang.Object value,
                           java.lang.String name)
Asserts whether the value is not null

Parameters:
value - the value to test
name - the key that resolved the value
Throws:
java.lang.IllegalArgumentException - is thrown if assertion fails


Copyright © 2015 Red Hat. All Rights Reserved.