Class SleighUtil


  • public class SleighUtil
    extends java.lang.Object
    Utilities for Collections
    • Constructor Summary

      Constructors 
      Constructor Description
      SleighUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int compareArrays​(byte[] a, byte[] b)
      Compare two byte arrays by their corresponding entries If the two arrays have differing lengths, the shorter precedes the longer.
      static <T extends java.lang.Comparable<T>>
      int
      compareInOrder​(java.util.Collection<T> a, java.util.Collection<T> b)
      Compare two collections by their corresponding elements in order If the collections have differing sizes, the ordering does not matter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SleighUtil

        public SleighUtil()
    • Method Detail

      • compareInOrder

        public static <T extends java.lang.Comparable<T>> int compareInOrder​(java.util.Collection<T> a,
                                                                             java.util.Collection<T> b)
        Compare two collections by their corresponding elements in order If the collections have differing sizes, the ordering does not matter. The smaller collection precedes the larger. Otherwise, each corresponding pair of elements are compared. Once an unequal pair is found, the collections are ordered by those elements. This is analogous to String comparison.
        Parameters:
        a - the first set
        b - the second set
        Returns:
        a comparison result as in Comparable.compareTo(Object)
      • compareArrays

        public static int compareArrays​(byte[] a,
                                        byte[] b)
        Compare two byte arrays by their corresponding entries If the two arrays have differing lengths, the shorter precedes the longer. Otherwise, they are compared as in C's memcmp, except that Java bytes are signed.
        Parameters:
        a - the first array
        b - the second array
        Returns:
        a comparison result as in Comparable.compareTo(Object)