static Comparer < byte [ ] > getBestComparer ( ) { try { Class < ? > theClass = Class . forName ( UNSAFE_COMPARER_NAME ) ; // yes, UnsafeComparer does implement Comparer<byte[]> @ SuppressWarnings ( "unchecked" ) Comparer < byte [ ] > comparer = ( Comparer < byte [ ] > ) theClass . getEnumConstants ( ) [ 0 ] ; return comparer ; } catch ( Throwable t ) { // ensure we really catch *everything* LOG . error ( "Loading lexicographicalComparerJavaImpl..." ) ; return lexicographicalComparerJavaImpl ( ) ; } }
Returns the Unsafe - using Comparer or falls back to the pure - Java implementation if unable to do so .