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

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

Introduction

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

Prototype

public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements) 

Source Link

Document

Creates a mutable HashSet instance containing the given elements.

Usage

From source file:com.palantir.atlasdb.schema.KeyValueServiceMigrators.java

/**
 * Tables that are eligible for migration.
 */// w  w  w.j a  va 2  s  .com
public static Set<TableReference> getMigratableTableNames(KeyValueService kvs,
        Set<TableReference> unmigratableTables) {
    /*
     * Not all tables can be migrated. We run by default with a table-splitting KVS that pins
     * certain tables to always be in the legacy DB KVS (because that one supports
     * putUnlessExists), and those tables cannot and should not be migrated. Also, special
     * tables that are not controlled by the transaction table should not be
     * migrated.
     */
    HashSet<TableReference> tableNames = Sets.newHashSet(kvs.getAllTableNames());
    tableNames.removeAll(AtlasDbConstants.hiddenTables);
    tableNames.removeAll(unmigratableTables);
    return tableNames;
}

From source file:com.enonic.cms.framework.blob.gc.GarbageCollector.java

private int deleteUnused() throws Exception {
    final Set<BlobKey> keys = Sets.newHashSet(this.store.getAllKeys());
    keys.removeAll(this.finder.findKeys());

    for (final BlobKey key : keys) {
        this.store.deleteRecord(key);
    }/*w w w  .j av  a 2 s .  co  m*/

    return keys.size();
}

From source file:org.thiesen.collections.set.impl.MutableHashSet.java

public static <T> MutableHashSet<T> of(final T... elements) {
    return new MutableHashSet<T>(Sets.newHashSet(elements));
}

From source file:org.n3r.sandbox.db.mongo.model.heroes.Heroine.java

public static Heroine addBeast(Heroine heroine, Beast beast) {
    return new Heroine(heroine.getFirstName(), heroine.getLastName(), heroine.getAddress(),
            heroine.getChildren(), Sets.newHashSet(beast));
}

From source file:org.vclipse.condition.ui.refactoring.ConditionRefactoring.java

@Override
public Set<EClass> getTopLevelTypes() {
    return Sets.newHashSet(VCML_PACKAGE.getConditionSource());
}

From source file:org.vclipse.procedure.ui.refactoring.ProcedureRefactoring.java

@Override
public Set<EClass> getTopLevelTypes() {
    return Sets.newHashSet(VCML_PACKAGE.getProcedureSource());
}

From source file:org.vclipse.constraint.ui.refactoring.ConstraintRefactoring.java

@Override
public Set<EClass> getTopLevelTypes() {
    return Sets.newHashSet(VCML_PACKAGE.getConstraintSource());
}

From source file:tk.wurst_client.enigma.regexlist.RegexListEntry.java

public RegexListEntry(String[] target, String regex, String replacement) throws PatternSyntaxException {
    this.target = target == null ? null : Sets.newHashSet(target);
    this.regex = Pattern.compile(regex);
    this.replacement = replacement;
}

From source file:ezbake.thrift.authentication.X509Utils.java

private static Iterable<String> getValueOfType(final LdapName name, final DnFields type) {
    Preconditions.checkNotNull(name, "principal name must not be null");

    Set<String> values = Sets.newHashSet(FluentIterable.from(name.getRdns()).filter(new Predicate<Rdn>() {
        @Override/*from   w  w w.  j  a  v  a  2  s  . com*/
        public boolean apply(Rdn rdn) {
            return rdn.getType().equals(type.toString());
        }
    }).transform(new Function<Rdn, String>() {

        @Override
        public String apply(Rdn rdn) {
            return rdn.getValue().toString();
        }
    }));

    return values;
}

From source file:com.clarkparsia.versioning.sparql.RDFDiff.java

@SuppressWarnings("unchecked")
private static Set<Statement> createSet(Iterable<Statement> stmts) {
    return (stmts instanceof Set) ? (Set) stmts : Sets.newHashSet(stmts);
}