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:org.elasticsearch.index.deletionpolicy.SnapshotIndexCommitExistsMatcher.java

@Override
public boolean matchesSafely(SnapshotIndexCommit snapshotIndexCommit) {
    try {//from ww  w .j  av a 2 s.c o  m
        HashSet<String> files = Sets.newHashSet(snapshotIndexCommit.getDirectory().listAll());
        for (String fileName : snapshotIndexCommit.getFiles()) {
            if (files.contains(fileName) == false) {
                return false;
            }
        }
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    return true;
}

From source file:com.infinities.keystone4j.extension.ExtensionApi.java

public ExtensionsWrapper getExtensionsInfo() {
    return new ExtensionsWrapper(Sets.newHashSet(extensions.values()));
}

From source file:com.opengamma.financial.analytics.model.bond.BondMarketYieldFunction.java

@Override
protected Set<ComputedValue> getComputedValues(final FunctionExecutionContext context, final double value,
        final BondSecurity security, final ComputationTarget target) {
    final ValueSpecification specification = new ValueSpecification(
            new ValueRequirement(ValueRequirementNames.MARKET_YTM, security), getUniqueId());
    return Sets.newHashSet(new ComputedValue(specification, value));
}

From source file:org.lilyproject.tools.import_.cli.DefaultImportListener.java

public DefaultImportListener(PrintStream out, EntityType... suppressedTypes) {
    this.out = out;
    this.suppressedTypes = Sets.newHashSet(suppressedTypes);
    counters = new EnumMap<EntityType, AtomicInteger>(EntityType.class);
    for (EntityType type : EntityType.values()) {
        counters.put(type, new AtomicInteger(0));
    }/*from  w ww  .  ja  va  2 s. co  m*/
}

From source file:com.github.autermann.wps.matlab.util.FileExtensionPredicate.java

public FileExtensionPredicate(Iterable<? extends String> extensions) {
    Preconditions.checkNotNull(extensions);
    this.extensions = Sets.newHashSet(extensions);
}

From source file:com.opengamma.financial.analytics.model.bond.BondMarketDirtyPriceFunction.java

@Override
protected Set<ComputedValue> getComputedValues(final FunctionExecutionContext context, final double value,
        final BondSecurity security, final ComputationTarget target) {
    final ValueSpecification specification = new ValueSpecification(
            new ValueRequirement(ValueRequirementNames.MARKET_DIRTY_PRICE, security), getUniqueId());
    return Sets.newHashSet(new ComputedValue(specification, value));
}

From source file:com.opengamma.financial.analytics.model.bond.BondPV01CurrencyCurveFunction.java

@Override
public Set<ValueRequirement> getRequirements(final FunctionCompilationContext context,
        final ComputationTarget target, final ValueRequirement desiredValue) {
    final String curveName = YieldCurveFunction.getCurveName(context, desiredValue);
    return Sets.newHashSet(new ValueRequirement(ValueRequirementNames.YIELD_CURVE,
            ComputationTargetType.CURRENCY, BondFunctionUtils.getCurrencyID(target),
            ValueProperties.with(ValuePropertyNames.CURVE, curveName).get()));
}

From source file:org.auraframework.impl.java.JavaSourceLoader.java

@Override
public Set<String> getNamespaces() {
    return Sets.newHashSet("*");
}

From source file:ollie.internal.codegen.step.ColumnStep.java

@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
    final Set<Element> elements = Sets.newHashSet(roundEnv.getElementsAnnotatedWith(Column.class));
    for (Element element : elements) {
        validator.validate(element.getEnclosingElement(), element);
    }// ww  w  . ja va  2s.co  m
    return false;
}

From source file:cn.sunxyz.config.SwaggerConfiguration.java

@Bean
public Docket createUserInfoRestApi(ApiInfo apiInfo) {
    return new Docket(DocumentationType.SWAGGER_2).groupName("user")
            .produces(Sets.newHashSet("application/json")).consumes(Sets.newHashSet("application/json"))
            .protocols(Sets.newHashSet("http", "https")).apiInfo(apiInfo).select()
            .apis(RequestHandlerSelectors.basePackage("cn.sunxyz.controller")).paths(regex("/api/user.*"))
            .build();/*  w  ww  .jav  a  2  s.c  o m*/
}