Example usage for com.google.common.collect Maps newTreeMap

List of usage examples for com.google.common.collect Maps newTreeMap

Introduction

In this page you can find the example usage for com.google.common.collect Maps newTreeMap.

Prototype

public static <K extends Comparable, V> TreeMap<K, V> newTreeMap() 

Source Link

Document

Creates a mutable, empty TreeMap instance using the natural ordering of its elements.

Usage

From source file:com.google.gerrit.server.group.ListGroups.java

@Override
public Object apply(TopLevelResource resource)
        throws AuthException, BadRequestException, ResourceConflictException, Exception {
    final Map<String, GroupInfo> output = Maps.newTreeMap();
    for (GroupInfo info : get()) {
        output.put(Objects.firstNonNull(info.name, "Group " + Url.decode(info.id)), info);
        info.name = null;// w  ww.  j av  a2s . c  o  m
    }
    return OutputFormat.JSON.newGson().toJsonTree(output, new TypeToken<Map<String, GroupInfo>>() {
    }.getType());
}