Example usage for com.google.common.collect Sets newTreeSet

List of usage examples for com.google.common.collect Sets newTreeSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets newTreeSet.

Prototype

public static <E extends Comparable> TreeSet<E> newTreeSet() 

Source Link

Document

Creates a mutable, empty TreeSet instance sorted by the natural sort ordering of its elements.

Usage

From source file:org.apache.drill.exec.store.mapr.db.json.MaprDBJsonRecordReader.java

@Override
protected Collection<SchemaPath> transformColumns(Collection<SchemaPath> columns) {
    Set<SchemaPath> transformed = Sets.newLinkedHashSet();
    if (!isStarQuery() && !disablePushdown) {
        Set<FieldPath> projectedFieldsSet = Sets.newTreeSet();
        for (SchemaPath column : columns) {
            if (column.getRootSegment().getPath().equalsIgnoreCase(ID_KEY)) {
                /*//from  ww  w.j  a  v a 2 s  .com
                 * we do not include _id field in the set of projected fields
                 * because the DB currently can not return a document if only
                 * the _id field was projected. This should really be fixed in
                 * the DB client (Bug 21708) to avoid transferring the entire
                 * document when only _id is requested.
                 */
                // projectedFieldsList.add(ID_FIELD);
                includeId = true;
            } else {
                projectedFieldsSet.add(getFieldPathForProjection(column));
            }
            transformed.add(column);
        }
        if (projectedFieldsSet.size() > 0) {
            projectedFields = projectedFieldsSet.toArray(new FieldPath[projectedFieldsSet.size()]);
        }
    } else {
        transformed.add(AbstractRecordReader.STAR_COLUMN);
        includeId = true;
    }

    /*
     * (Bug 21708) if we are projecting only the id field, save that condition here.
     */
    idOnly = !isStarQuery() && (projectedFields == null);
    return transformed;
}

From source file:com.netflix.ice.basic.BasicTagGroupManager.java

public Collection<Account> getAccounts(Interval interval, TagLists tagLists) {
    Set<Account> result = Sets.newTreeSet();
    Set<TagGroup> tagGroupsInRange = getTagGroupsInRange(getMonthMillis(interval));

    for (TagGroup tagGroup : tagGroupsInRange) {
        if (tagLists.contains(tagGroup))
            result.add(tagGroup.account);
    }//from  w  w w.j av  a  2  s.c om

    return result;
}