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

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

Introduction

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

Prototype

public static <E> ImmutableList<E> of(E element) 

Source Link

Usage

From source file:com.opengamma.strata.measure.swap.SwapMeasureCalculations.java

LegAmounts legInitialNotional(ResolvedSwapTrade trade) {
    List<Pair<ResolvedSwapLeg, CurrencyAmount>> notionals = trade.getProduct().getLegs().stream()
            .map(leg -> Pair.of(leg, buildLegNotional(leg))).collect(toList());
    CurrencyAmount firstNotional = notionals.stream().filter(pair -> pair.getSecond() != NOT_FOUND)
            .map(pair -> pair.getSecond()).findFirst()
            .orElseThrow(() -> new IllegalArgumentException("No notional found on any swap leg"));
    notionals = notionals.stream()//from w ww .j  a v a  2  s  .  c o  m
            .map(pair -> pair.getSecond() != NOT_FOUND ? pair : Pair.of(pair.getFirst(), firstNotional))
            .collect(toList());
    ImmutableList<LegAmount> legAmounts = notionals.stream()
            .map(pair -> SwapLegAmount.of(pair.getFirst(), pair.getSecond())).collect(toImmutableList());
    return LegAmounts.of(legAmounts);
}

From source file:io.prestosql.sql.planner.optimizations.LocalProperties.java

public static <T> List<LocalProperty<T>> grouped(Collection<T> columns) {
    return ImmutableList.of(new GroupingProperty<>(columns));
}

From source file:com.mysema.query.types.TemplateExpressionImpl.java

public static <C> Expression<C> create(Class<C> cl, String template, Object one) {
    return new TemplateExpressionImpl<C>(cl, TemplateFactory.DEFAULT.create(template), ImmutableList.of(one));
}

From source file:com.spectralogic.ds3autogen.java.utils.ResponseParserGeneratorTestUtil.java

public static Ds3ResponseCode getBaseResponseCode() {
    return new Ds3ResponseCode(202, ImmutableList.of(new Ds3ResponseType("com.test.Type", null)));
}

From source file:com.mysema.query.types.template.BooleanTemplate.java

public static BooleanExpression create(String template, Object one) {
    return new BooleanTemplate(TemplateFactory.DEFAULT.create(template), ImmutableList.of(one));
}

From source file:com.querydsl.core.types.template.StringTemplate.java

public static StringExpression create(String template, Object one) {
    return new StringTemplate(TemplateFactory.DEFAULT.create(template), ImmutableList.of(one));
}

From source file:com.spotify.heroic.metric.FetchData.java

public static Result errorResult(final QueryTrace trace, final RequestError error) {
    return new Result(trace, ImmutableList.of(error));
}

From source file:com.spectralogic.ds3autogen.java.test.helpers.RequestGeneratorTestHelper.java

/**
 * Creates a populated Ds3Request to be used by the Java generators
 * for testing.//from   w ww . j  a  v  a2s  .  c o m
 */
public static Ds3Request createSimpleTestDs3Request() {
    return new Ds3Request("RequestName", HttpVerb.DELETE, Classification.spectrads3, Requirement.REQUIRED,
            Requirement.REQUIRED, Action.BULK_DELETE, Resource.JOB, ResourceType.NON_SINGLETON,
            Operation.START_BULK_GET, true, null,
            ImmutableList.of(new Ds3Param("RequestType",
                    "com.spectralogic.s3.common.dao.domain.ds3.JobRequestType", false)),
            ImmutableList.of(
                    new Ds3Param("Operation", "com.spectralogic.s3.server.request.rest.RestOperationType",
                            false),
                    new Ds3Param("Priority", "com.spectralogic.s3.common.dao.domain.ds3.BlobStoreTaskPriority",
                            false),
                    new Ds3Param("NotificationEndPoint", "java.lang.String", true)));
}

From source file:org.apache.james.jmap.model.SetFilterResponse.java

public static SetFilterResponse updated() {
    return new SetFilterResponse(ImmutableList.of(SINGLETON), ImmutableMap.of());
}

From source file:com.wrmsr.wava.java.lang.tree.JTrees.java

public static List<JStatement> jflatten(JStatement statement) {
    if (statement instanceof JBlock) {
        return ((JBlock) statement).getBody();
    } else {/*from  w ww. j  av a2s  .  c o m*/
        return ImmutableList.of(statement);
    }
}