hudson.plugins.violations.util
Class Compares

java.lang.Object
  extended by hudson.plugins.violations.util.Compares

public class Compares
extends java.lang.Object

A utility class to help compare objects.


Constructor Summary
Compares()
           
 
Method Summary
static int compare(java.lang.Comparable... objects)
          Compare a list of pair of objects.
static int compare(java.lang.Comparable a, java.lang.Comparable b)
          Compare two (nullable) objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compares

public Compares()
Method Detail

compare

public static int compare(java.lang.Comparable a,
                          java.lang.Comparable b)
Compare two (nullable) objects.

Parameters:
a - the first object
b - the second object
Returns:
0 if the objects are the same, -1 if first is less than second or is null, 1 if second is less that first or is null.

compare

public static int compare(java.lang.Comparable... objects)
Compare a list of pair of objects.

Returns:
0 if all pairs are the same, else the result of the first pair that is not the same.


Copyright © 2004-2012. All Rights Reserved.