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() 

Source Link

Document

Creates a mutable, initially empty HashSet instance.

Usage

From source file:org.opendaylight.netconf.confignetconfconnector.osgi.NetconfOperationProvider.java

private static Set<NetconfOperation> setUpOperations(final ConfigSubsystemFacade configSubsystemFacade,
        String netconfSessionIdForReporting) {
    Set<NetconfOperation> ops = Sets.newHashSet();

    GetConfig getConfigOp = new GetConfig(configSubsystemFacade, Optional.<String>absent(),
            netconfSessionIdForReporting);

    ops.add(getConfigOp);//from  ww w  .  j a  v  a  2  s. c o  m
    ops.add(new EditConfig(configSubsystemFacade, netconfSessionIdForReporting));
    ops.add(new Commit(configSubsystemFacade, netconfSessionIdForReporting));
    ops.add(new Lock(netconfSessionIdForReporting));
    ops.add(new UnLock(netconfSessionIdForReporting));
    ops.add(new Get(configSubsystemFacade, netconfSessionIdForReporting));
    ops.add(new DiscardChanges(configSubsystemFacade, netconfSessionIdForReporting));
    ops.add(new Validate(configSubsystemFacade, netconfSessionIdForReporting));
    ops.add(new RuntimeRpc(configSubsystemFacade, netconfSessionIdForReporting));

    return ops;
}

From source file:com.enonic.cms.core.xslt.portal.XsltTemplatesCacheEntry.java

public XsltTemplatesCacheEntry(final FileResourceName name, final Templates templates) {
    this.name = name;
    this.templates = templates;
    this.timestamp = System.currentTimeMillis();
    this.resourceSet = Sets.newHashSet();
    this.resourceSet.add(this.name);
    this.lastValidated = this.timestamp;
}

From source file:com.eincs.decanter.utils.collection.SetWrapper.java

public SetWrapper() {
    this.delegate = Sets.newHashSet();
}

From source file:presto.android.gui.GraphUtil.java

public Set<NNode> reachableNodes(NNode n) {
    Set<NNode> res = Sets.newHashSet();
    findReachableNodes(n, res);
    return res;
}

From source file:heros.flowfunc.Compose.java

public Set<D> computeTargets(D source) {
    Set<D> curr = Sets.newHashSet();
    curr.add(source);//from w ww. j a  v  a 2s  .  c om
    for (FlowFunction<D> func : funcs) {
        Set<D> next = Sets.newHashSet();
        for (D d : curr)
            next.addAll(func.computeTargets(d));
        curr = next;
    }
    return curr;
}

From source file:org.carrot2.output.metrics.IdealPartitioningBasedMetric.java

Set<Object> getPartitions(List<Document> documents) {
    final HashSet<Object> partitions = Sets.newHashSet();
    for (Document document : documents) {
        final Collection<Object> documentPartitions = document
                .<Collection<Object>>getField(partitionIdFieldName);
        if (documentPartitions != null) {
            partitions.addAll(documentPartitions);
        }//w w w  . j av  a 2  s  . c o  m
    }
    return partitions;
}

From source file:org.eclipse.recommenders.internal.privacy.rcp.data.PrivacySettingsSerciveHelper.java

public static Set<PrivatePermission> getCategoriesPermissions(Set<? extends ICategory> categories) {
    Set<PrivatePermission> permissions = Sets.newHashSet();

    for (ICategory principal : categories) {
        for (PrivatePermission permission : principal.getPermissions()) {
            permissions.add(permission);
        }//  w  ww  .j  a va  2  s  .  c o m
    }
    return permissions;
}

From source file:de.cosmocode.palava.ipc.IpcCommands.java

/**
 * Returns a set of all {@link Throwable}s the given command is allowed to throw according to
 * it's documentation of {@link Throw} and {@link Throws} annotations.
 * //from   w  w w.  jav  a 2  s  . c  o  m
 * @since 1.7
 * @param command the command to be checked
 * @return a set of all throwables the command is allowed to throw
 */
public static Set<Class<? extends Throwable>> getThrows(Class<? extends IpcCommand> command) {
    final Set<Class<? extends Throwable>> throwables = Sets.newHashSet();

    if (command.isAnnotationPresent(Throw.class)) {
        throwables.add(command.getAnnotation(Throw.class).name());
    }

    if (command.isAnnotationPresent(Throws.class)) {
        for (Throw t : command.getAnnotation(Throws.class).value()) {
            throwables.add(t.name());
        }
    }

    return throwables;
}

From source file:com.opengamma.engine.marketdata.live.MarketDataAvailabilityNotification.java

public static MarketDataAvailabilityNotification fromFudgeMsg(final FudgeDeserializer deserializer,
        final FudgeMsg msg) {
    FudgeMsg schemesMsg = msg.getMessage(SCHEMES);
    Set<ExternalScheme> schemes = Sets.newHashSet();
    for (FudgeField field : schemesMsg) {
        String schemeName = deserializer.fieldValueToObject(String.class, field);
        schemes.add(ExternalScheme.of(schemeName));
    }// ww w. ja v a  2 s  .  co  m
    return new MarketDataAvailabilityNotification(schemes);
}

From source file:eu.project.ttc.utils.TermIndexUtils.java

public static Set<TermVariation> selectTermVariations(TermIndex termIndex, VariationType type,
        String ruleName) {// ww w  . j  ava 2s  .c  om
    Set<TermVariation> selected = Sets.newHashSet();
    for (TermVariation tv : selectTermVariations(termIndex, type))
        if (Objects.equal(ruleName, tv.getInfo()))
            selected.add(tv);
    return selected;
}