Example usage for com.google.common.collect Comparators lexicographical

List of usage examples for com.google.common.collect Comparators lexicographical

Introduction

In this page you can find the example usage for com.google.common.collect Comparators lexicographical.

Prototype




public static <T, S extends T> Comparator<Iterable<S>> lexicographical(Comparator<T> comparator) 

Source Link

Document

Returns a new comparator which sorts iterables by comparing corresponding elements pairwise until a nonzero result is found; imposes "dictionary order."

Usage

From source file:io.atomix.core.tree.DocumentPath.java

@Override
public int compareTo(DocumentPath that) {
    return Comparators.lexicographical(Comparator.<String>naturalOrder()).compare(this.pathElements,
            that.pathElements);//from  ww  w.  jav  a 2  s.co m
}