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:edu.bsu.storygame.core.model.Narrative.java

public Set<Skill> skills() {
    Set<Skill> result = Sets.newTreeSet();
    for (EncounterDeck deck : map.values()) {
        for (Encounter encounter : deck) {
            for (Reaction reaction : encounter.reactions) {
                for (Story story : reaction.stories) {
                    for (SkillTrigger trigger : story.triggers) {
                        result.add(trigger.skill);
                    }//  ww  w  . j  av a 2  s  . com
                }
            }
        }
    }
    return result;
}

From source file:nl.knaw.huygens.timbuctoo.rest.resources.VREResource.java

@GET
@Produces({ MediaType.APPLICATION_JSON })
@APIDesc("Lists the available VRE's.")
public Set<String> getAvailableVREs() {
    Set<String> ids = Sets.newTreeSet();
    for (VRE vre : vres.getAll()) {
        ids.add(vre.getVreId());/*from w w  w  .  java  2s  .  c  o  m*/
    }
    return ids;
}

From source file:com.facebook.buck.jvm.java.abi.MethodMirror.java

public MethodMirror(int access, String name, String desc, String signature, String[] exceptions) {
    super(Opcodes.ASM5);

    this.access = access;
    this.name = name;
    this.desc = Preconditions.checkNotNull(desc);
    this.signature = signature;
    this.exceptions = exceptions;

    this.annotations = Sets.newTreeSet();

    int paramCount = countParameters(desc);
    this.parameterAnnotations = new AnnotationMirror[paramCount];

    this.key = name + desc + paramCount;
}

From source file:com.spotify.helios.cli.command.MasterListCommand.java

@Override
int run(final Namespace options, final HeliosClient client, final PrintStream out, final boolean json,
        final BufferedReader stdin) throws ExecutionException, InterruptedException {

    final List<String> masters = client.listMasters().get();
    final boolean full = options.getBoolean(fullArg.getDest());

    final SortedSet<String> sortedMasters = Sets.newTreeSet();

    if (json) {//from  w w  w .j  av a  2s .com
        for (final String host : masters) {
            sortedMasters.add(formatHostname(full, host));
        }
        out.println(Json.asPrettyStringUnchecked(sortedMasters));
    } else {
        for (final String host : masters) {
            out.println(formatHostname(full, host));
        }
    }

    return 0;
}

From source file:com.metamx.druid.partition.PartitionHolder.java

public PartitionHolder(PartitionHolder partitionHolder) {
    this.holderSet = Sets.newTreeSet();
    this.holderSet.addAll(partitionHolder.holderSet);
}

From source file:cubicchunks.visibility.CubeSelector.java

public CubeSelector() {
    m_visibleCubes = Sets.newTreeSet();
    m_newlyVisibleCubes = Sets.newTreeSet();
    m_newlyHiddenCubes = Sets.newTreeSet();
    m_nextVisibleCubes = Sets.newTreeSet();

    m_visibleColumns = Sets.newTreeSet();
    m_newlyVisibleColumns = Sets.newTreeSet();
    m_newlyHiddenColumns = Sets.newTreeSet();
    m_nextVisibleColumns = Sets.newTreeSet();
}

From source file:com.google.template.soy.jssrc.internal.GenDirectivePluginRequiresVisitor.java

@Override
public SortedSet<String> exec(SoyNode soyNode) {
    requiredJsLibNames = Sets.newTreeSet();
    visit(soyNode);
    return requiredJsLibNames;
}

From source file:com.google.gerrit.pgm.init.InitDatabase.java

public void run() {
    ui.header("SQL Database");

    Set<String> allowedValues = Sets.newTreeSet();
    Injector i = Guice.createInjector(PRODUCTION, new DatabaseConfigModule(site));
    List<Binding<DatabaseConfigInitializer>> dbConfigBindings = i
            .findBindingsByType(new TypeLiteral<DatabaseConfigInitializer>() {
            });//from  ww  w . j  av  a  2  s .  c om
    for (Binding<DatabaseConfigInitializer> binding : dbConfigBindings) {
        Annotation annotation = binding.getKey().getAnnotation();
        if (annotation instanceof Named) {
            allowedValues.add(((Named) annotation).value());
        }
    }

    if (!Strings.isNullOrEmpty(database.get("url")) && Strings.isNullOrEmpty(database.get("type"))) {
        database.set("type", "jdbc");
    }

    String dbType = database.select("Database server type", "type", "h2", allowedValues);

    DatabaseConfigInitializer dci = i
            .getInstance(Key.get(DatabaseConfigInitializer.class, Names.named(dbType.toLowerCase())));

    if (dci instanceof MySqlInitializer) {
        libraries.mysqlDriver.downloadRequired();
    }

    dci.initConfig(database);
}

From source file:org.apache.lens.cube.metadata.timeline.StoreAllPartitionTimeline.java

public StoreAllPartitionTimeline(String storageTableName, UpdatePeriod updatePeriod, String partCol) {
    super(storageTableName, updatePeriod, partCol);
    allPartitions = Sets.newTreeSet();
}

From source file:org.incode.eurocommercial.contactapp.dom.contacts.ContactRepository.java

@Programmatic
public java.util.List<Contact> find(final String regex) {
    java.util.SortedSet<Contact> contacts = Sets.newTreeSet();
    contacts.addAll(findByName(regex));/*from   ww  w . j av a  2  s .c  o m*/
    contacts.addAll(findByCompany(regex));
    contacts.addAll(findByContactRoleName(regex));
    contacts.addAll(findByEmail(regex));
    for (ContactGroup contactGroup : contactGroupRepository.findByName(regex)) {
        contacts.addAll(findByContactGroup(contactGroup));
    }
    return asSortedList(contacts);
}