Example usage for com.google.common.collect ImmutableSet of

List of usage examples for com.google.common.collect ImmutableSet of

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSet of.

Prototype

@SuppressWarnings("unchecked")
    public static <E> ImmutableSet<E> of(E e1, E e2) 

Source Link

Usage

From source file:com.opengamma.strata.report.framework.expression.CurrencyAmountTokenEvaluator.java

@Override
public ImmutableSet<String> tokens(CurrencyAmount amount) {
    return ImmutableSet.of(CURRENCY_FIELD, AMOUNT_FIELD);
}

From source file:producerstest.multibindings.MultibindingProducerModule.java

@Produces
@ElementsIntoSet//from  w w w  . j ava2s . c  om
static ListenableFuture<Set<String>> futureStrs() {
    return Futures.<Set<String>>immediateFuture(ImmutableSet.of("foo1", "foo2"));
}

From source file:org.eclipse.tracecompass.internal.lttng2.ust.core.callstack.LttngUstCallStackAnalysisRequirement.java

private static Collection<TmfAbstractAnalysisRequirement> getSubRequirements(ILttngUstEventLayout layout) {
    Set<@NonNull String> requiredEventsFields = ImmutableSet.of(layout.contextProcname(), layout.contextVtid());

    // Requirement for the cyg_profile events
    TmfAnalysisEventFieldRequirement entryReq = new TmfAnalysisEventFieldRequirement(
            layout.eventCygProfileFuncEntry(), requiredEventsFields, PriorityLevel.MANDATORY);

    TmfAbstractAnalysisRequirement exitReq = new TmfAnalysisEventFieldRequirement(
            layout.eventCygProfileFuncExit(), requiredEventsFields, PriorityLevel.MANDATORY);

    TmfAbstractAnalysisRequirement cygProfile = new TmfCompositeAnalysisRequirement(
            ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY);

    // Requirement for the cyg_profile_fast events
    entryReq = new TmfAnalysisEventFieldRequirement(layout.eventCygProfileFastFuncEntry(), requiredEventsFields,
            PriorityLevel.MANDATORY);/*from  w w  w.j  av  a  2  s  . c  om*/

    exitReq = new TmfAnalysisEventFieldRequirement(layout.eventCygProfileFastFuncExit(), requiredEventsFields,
            PriorityLevel.MANDATORY);
    TmfAbstractAnalysisRequirement cygProfileFast = new TmfCompositeAnalysisRequirement(
            ImmutableSet.of(entryReq, exitReq), PriorityLevel.MANDATORY);

    return ImmutableSet.of(cygProfile, cygProfileFast);
}

From source file:producerstest.MultibindingProducerModule.java

@Produces(type = SET_VALUES)
@PossiblyThrowingSet
static Set<String> successfulStringsForSet() {
    return ImmutableSet.of("double", "ton");
}

From source file:com.github.megatronking.stringfog.plugin.StringFogClassGenerator.java

public static void generate(File outputFile, String packageName, String className, String key,
        String implementation) throws IOException {
    File outputDir = outputFile.getParentFile();
    if (!outputDir.exists() && !outputDir.mkdirs()) {
        throw new IOException("Can not mkdirs the dir: " + outputDir);
    }/*from w  w  w  .j  av  a  2  s. com*/

    int lastIndexOfDot = implementation.lastIndexOf(".");
    String implementationSimpleClassName = lastIndexOfDot == -1 ? implementation
            : implementation.substring(implementation.lastIndexOf(".") + 1);

    JavaWriter javaWriter = new JavaWriter(new FileWriter(outputFile));
    javaWriter.emitPackage(packageName);
    javaWriter.emitEmptyLine();
    javaWriter.emitImports(implementation);
    javaWriter.emitEmptyLine();

    javaWriter.emitJavadoc("Generated code from StringFog gradle plugin. Do not modify!");
    javaWriter.beginType(className, "class", ImmutableSet.of(Modifier.PUBLIC, Modifier.FINAL));

    javaWriter.emitField(implementationSimpleClassName, "IMPL",
            ImmutableSet.of(Modifier.PRIVATE, Modifier.STATIC, Modifier.FINAL),
            "new " + implementationSimpleClassName + "()");

    javaWriter.emitEmptyLine();
    javaWriter.beginMethod(String.class.getSimpleName(), "encrypt",
            ImmutableSet.of(Modifier.PUBLIC, Modifier.STATIC), String.class.getSimpleName(), "value");
    javaWriter.emitStatement("return " + "IMPL.encrypt(value, \"" + key + "\")");
    javaWriter.endMethod();

    javaWriter.emitEmptyLine();
    javaWriter.beginMethod(String.class.getSimpleName(), "decrypt",
            ImmutableSet.of(Modifier.PUBLIC, Modifier.STATIC), String.class.getSimpleName(), "value");
    javaWriter.emitStatement("return " + "IMPL.decrypt(value, \"" + key + "\")");
    javaWriter.endMethod();

    javaWriter.emitEmptyLine();
    javaWriter.beginMethod(boolean.class.getSimpleName(), "overflow",
            ImmutableSet.of(Modifier.PUBLIC, Modifier.STATIC), String.class.getSimpleName(), "value");
    javaWriter.emitStatement("return " + "IMPL.overflow(value, \"" + key + "\")");
    javaWriter.endMethod();

    javaWriter.emitEmptyLine();
    javaWriter.endType();

    javaWriter.close();
}

From source file:producerstest.multibindings.MultibindingProducerModule.java

@Produces
@ElementsIntoSet/*from w w  w.j  a v  a  2  s.  c o m*/
static Set<ListenableFuture<String>> strFutures() {
    return ImmutableSet.of(Futures.immediateFuture("baz1"), Futures.immediateFuture("baz2"));
}

From source file:com.github.mike10004.stormpathacctmgr.StormpathResourceExceptionMapper.java

public StormpathResourceExceptionMapper() {
    statusesNotWorthyOfStackTraces = ImmutableSet.of(400, 404);
}

From source file:org.eclipse.che.api.workspace.server.WorkspaceMessageBodyAdapter.java

@Override
public Set<Class<?>> getTriggers() {
    return ImmutableSet.of(Workspace.class, WorkspaceDto.class);
}

From source file:auth.TinfoilLoginForm.java

@Override
public Set<MetaField<?>> fields() {
    return ImmutableSet.of(USERNAME, PASSWORD);
}

From source file:com.github.imasahiro.stringformatter.processor.specifier.FloatFormatConversionType.java

@Override
public Set<TypeMirror> getType(Types typeUtil, Elements elementUtil) {
    return ImmutableSet.of(typeUtil.getPrimitiveType(TypeKind.FLOAT),
            typeUtil.getPrimitiveType(TypeKind.DOUBLE));
}