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> TreeSet<E> newTreeSet(Comparator<? super E> comparator) 

Source Link

Document

Creates a mutable, empty TreeSet instance with the given comparator.

Usage

From source file:org.apache.druid.query.metadata.metadata.ListColumnIncluderator.java

@JsonCreator
public ListColumnIncluderator(@JsonProperty("columns") List<String> columns) {
    this.columns = Sets.newTreeSet(String.CASE_INSENSITIVE_ORDER);
    this.columns.addAll(columns);
}

From source file:com.spotify.styx.cli.CliUtil.java

private static TreeSet<RunStateData> newSortedStateSet() {
    return Sets.newTreeSet(RunStateData.PARAMETER_COMPARATOR);
}

From source file:de.tu_berlin.dima.oligos.stat.distribution.histogram.CustomHistogram.java

public CustomHistogram(Operator<T> operator) {
    setOperator(operator);//from  www . j  av  a2s .c o  m
    this.lowerBounds = Sets.newTreeSet(operator);
    this.upperBounds = Sets.newTreeSet(operator);
    this.frequencies = Lists.newArrayList();
}

From source file:org.jboss.hal.ballroom.form.BlacklistValidation.java

public BlacklistValidation(Iterable<String> blacklist) {
    this.blacklist = Sets.newTreeSet(blacklist);
}

From source file:org.jclouds.elastichosts.functions.SplitNewlines.java

@Override
public Set<String> apply(HttpResponse response) {
    return Sets.newTreeSet(Splitter.on('\n').split(returnStringIf200.apply(response)));
}

From source file:org.gradle.api.internal.artifacts.ivyservice.resolveengine.graph.conflicts.UpgradeCapabilityResolver.java

@Override
public void resolve(CapabilitiesConflictHandler.ResolutionDetails details) {
    Collection<? extends Capability> capabilityVersions = details.getCapabilityVersions();
    if (capabilityVersions.size() > 1) {
        Set<Capability> sorted = Sets.newTreeSet(new Comparator<Capability>() {
            @Override//from w ww  . j a va  2  s  .c  om
            public int compare(Capability o1, Capability o2) {
                VersionNumber v1 = VersionNumber.parse(o1.getVersion());
                VersionNumber v2 = VersionNumber.parse(o2.getVersion());
                return v2.compareTo(v1);
            }
        });
        sorted.addAll(capabilityVersions);
        boolean first = true;
        for (Capability capability : sorted) {
            if (!first) {
                Collection<? extends CapabilitiesConflictHandler.CandidateDetails> candidates = details
                        .getCandidates(capability);
                for (CapabilitiesConflictHandler.CandidateDetails candidate : candidates) {
                    candidate.evict();
                }
            }
            first = false;
        }
    }
}

From source file:brooklyn.rest.transform.CatalogTransformer.java

public static CatalogEntitySummary catalogEntitySummary(BrooklynRestResourceUtils b,
        CatalogItem<? extends Entity, EntitySpec<?>> item) {
    EntitySpec<?> spec = b.getCatalog().createSpec(item);
    EntityDynamicType typeMap = BrooklynTypes.getDefinedEntityType(spec.getType());
    EntityType type = typeMap.getSnapshot();

    Set<EntityConfigSummary> config = Sets.newTreeSet(SummaryComparators.nameComparator());
    Set<SensorSummary> sensors = Sets.newTreeSet(SummaryComparators.nameComparator());
    Set<EffectorSummary> effectors = Sets.newTreeSet(SummaryComparators.nameComparator());

    for (ConfigKey<?> x : type.getConfigKeys())
        config.add(EntityTransformer.entityConfigSummary(x, typeMap.getConfigKeyField(x.getName())));
    for (Sensor<?> x : type.getSensors())
        sensors.add(SensorTransformer.sensorSummaryForCatalog(x));
    for (Effector<?> x : type.getEffectors())
        effectors.add(EffectorTransformer.effectorSummaryForCatalog(x));

    return new CatalogEntitySummary(item.getSymbolicName(), item.getVersion(), item.getDisplayName(),
            item.getJavaType(), item.getPlanYaml(), item.getDescription(),
            tidyIconLink(b, item, item.getIconUrl()), config, sensors, effectors, makeLinks(item));
}

From source file:org.solenopsis.checkstyle.api.LocalizedMessages.java

/**
 * Gets the logged messages.
 * @return the logged messages
 */
public SortedSet<LocalizedMessage> getMessages() {
    return Sets.newTreeSet(messages);
}

From source file:biz.ganttproject.impex.msproject2.CustomPropertyMapping.java

static Map<CustomPropertyDefinition, FieldType> buildMapping(HumanResourceManager resourceManager)
        throws MPXJException {
    final SortedSet<ResourceField> taskFields = Sets.newTreeSet(new Comparator<ResourceField>() {
        @Override/*  w  w  w.  java2s.  co  m*/
        public int compare(ResourceField o1, ResourceField o2) {
            return o1.ordinal() - o2.ordinal();
        }
    });
    taskFields.addAll(Arrays.asList(ResourceField.values()));
    return buildMapping(resourceManager.getCustomPropertyManager(), taskFields, ResourceField.class);
}

From source file:org.apache.isis.core.runtime.services.DeweyOrderUtil.java

static <V> List<Map.Entry<String, V>> deweySorted(Set<Map.Entry<String, V>> keys) {
    if (keys == null) {
        throw new IllegalArgumentException("Keys cannot be null");
    }//ww  w. ja va  2 s .co  m
    final Iterable<Parsed<V>> parsedIter = Iterables.transform(keys,
            new Function<Map.Entry<String, V>, Parsed<V>>() {
                @Override
                public Parsed<V> apply(Map.Entry<String, V> input) {
                    return new Parsed(input);
                }
            });

    final SortedSet<Parsed<V>> parseds = Sets.newTreeSet(parsedIter);
    final Iterable<Map.Entry<String, V>> transform = Iterables.transform(parseds,
            DeweyOrderUtil.<V>toMapEntry());
    return Lists.newArrayList(transform);
}