Example usage for com.google.common.collect ImmutableSortedMap reverseOrder

List of usage examples for com.google.common.collect ImmutableSortedMap reverseOrder

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSortedMap reverseOrder.

Prototype

public static <K extends Comparable<?>, V> Builder<K, V> reverseOrder() 

Source Link

Usage

From source file:com.xebialabs.overthere.cifs.PathMapper.java

@VisibleForTesting
PathMapper(final Map<String, String> mappings) {
    // longest first, so reverse lexicographical order
    ImmutableSortedMap.Builder<String, String> sharesForPath = ImmutableSortedMap.reverseOrder();
    ImmutableMap.Builder<String, String> pathsForShare = ImmutableMap.builder();
    for (Entry<String, String> mapping : mappings.entrySet()) {
        String pathPrefixToMatch = mapping.getKey();
        String shareForPathPrefix = mapping.getValue();
        sharesForPath.put(pathPrefixToMatch.toLowerCase(), shareForPathPrefix);
        pathsForShare.put(shareForPathPrefix.toLowerCase(), pathPrefixToMatch);
    }//from w  w  w  .j  a v a2s  .c o  m
    this.sharesForPaths = sharesForPath.build();
    this.pathsForShares = pathsForShare.build();
}