Class UnsignedBytes.LexicographicalComparatorHolder

java.lang.Object
com.google.common.primitives.UnsignedBytes.LexicographicalComparatorHolder
Enclosing class:
UnsignedBytes

static class UnsignedBytes.LexicographicalComparatorHolder extends Object
Provides a lexicographical comparator implementation; either a Java implementation or a faster implementation based on Unsafe.

Uses reflection to gracefully fall back to the Java implementation if Unsafe isn't available.

  • Field Details

    • UNSAFE_COMPARATOR_NAME

      static final String UNSAFE_COMPARATOR_NAME
    • BEST_COMPARATOR

      static final Comparator<byte[]> BEST_COMPARATOR
  • Constructor Details

    • LexicographicalComparatorHolder

      LexicographicalComparatorHolder()
  • Method Details

    • getBestComparator

      static Comparator<byte[]> getBestComparator()
      Returns the Unsafe-using Comparator, or falls back to the pure-Java implementation if unable to do so.