1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under the BSD-style license found in the
3 // LICENSE file in the root directory of this source tree. An additional grant
4 // of patent rights can be found in the PATENTS file in the same directory.
6 package org
.rocksdb
.util
;
8 import org
.rocksdb
.BuiltinComparator
;
9 import org
.rocksdb
.ComparatorOptions
;
10 import org
.rocksdb
.Slice
;
13 * This is a Java Native implementation of the C++
14 * equivalent ReverseBytewiseComparatorImpl using {@link Slice}
16 * The performance of Comparators implemented in Java is always
17 * less than their C++ counterparts due to the bridging overhead,
18 * as such you likely don't want to use this apart from benchmarking
19 * and you most likely instead wanted
20 * {@link BuiltinComparator#REVERSE_BYTEWISE_COMPARATOR}
22 public class ReverseBytewiseComparator
extends BytewiseComparator
{
24 public ReverseBytewiseComparator(final ComparatorOptions copt
) {
29 public String
name() {
30 return "rocksdb.java.ReverseBytewiseComparator";
34 public int compare(final Slice a
, final Slice b
) {
35 return -super.compare(a
, b
);