Example usage for com.google.common.primitives SignedBytes lexicographicalComparator

List of usage examples for com.google.common.primitives SignedBytes lexicographicalComparator

Introduction

In this page you can find the example usage for com.google.common.primitives SignedBytes lexicographicalComparator.

Prototype

public static Comparator<byte[]> lexicographicalComparator() 

Source Link

Document

Returns a comparator that compares two byte arrays lexicographically.

Usage

From source file:se.sics.ktoolbox.util.identifiable.basic.ByteIdentifier.java

@Override
public int compareTo(Identifier o) {
    ByteIdentifier that = (ByteIdentifier) o;
    return SignedBytes.lexicographicalComparator().compare(this.id, that.id);
}

From source file:com.jivesoftware.os.amza.api.ring.RingMember.java

@Override
public int compareTo(RingMember o) {
    return SignedBytes.lexicographicalComparator().compare(memberAsBytes, o.memberAsBytes);
}

From source file:io.hops.metadata.hdfs.entity.INode.java

@Override
public final int compareTo(INode other) {
    String left = name == null ? "" : name;
    String right = other.name == null ? "" : other.name;
    return SignedBytes.lexicographicalComparator().compare(left.getBytes(), right.getBytes());
}

From source file:org.apache.hadoop.hdfs.DFSUtilClient.java

/** Compare two byte arrays by lexicographical order. */
public static int compareBytes(byte[] left, byte[] right) {
    if (left == null) {
        left = EMPTY_BYTES;/* w  ww  .j  a  v  a 2  s . c o m*/
    }
    if (right == null) {
        right = EMPTY_BYTES;
    }
    return SignedBytes.lexicographicalComparator().compare(left, right);
}

From source file:org.apache.hadoop.hdfs.server.namenode.INode.java

@Override
public final int compareTo(byte[] bytes) {
    final byte[] name = getLocalNameBytes();
    final byte[] left = name == null ? EMPTY_BYTES : name;
    final byte[] right = bytes == null ? EMPTY_BYTES : bytes;
    return SignedBytes.lexicographicalComparator().compare(left, right);
}