List of usage examples for com.google.common.collect ImmutableList of
public static <E> ImmutableList<E> of(E element)
From source file:com.zimbra.cs.index.query.LuceneQuery.java
public static Collection<String> lookup(Multimap<String, String> multimap, String what) { Collection<String> types = multimap.get(what); if (types.isEmpty()) { types = ImmutableList.of(what); // Need new collection as original types is probably immutable }/*from w ww .ja v a 2 s .co m*/ return types; }
From source file:com.helion3.bedrock.commands.WorldCommand.java
public static CommandSpec getCommand() { ImmutableMap.Builder<List<String>, CommandCallable> builder = ImmutableMap .<List<String>, CommandCallable>builder(); builder.put(ImmutableList.of("difficulty"), DifficultyCommand.getCommand()); return CommandSpec.builder().executor((src, args) -> { return CommandResult.empty(); }).children(builder.build()).build(); }
From source file:org.apache.beam.runners.fnexecution.GrpcFnServer.java
/** * Create a {@link GrpcFnServer} for the provided {@link FnService} running on an arbitrary port. *///from ww w. j a v a 2 s .c o m public static <ServiceT extends FnService> GrpcFnServer<ServiceT> allocatePortAndCreateFor(ServiceT service, ServerFactory factory) throws IOException { ApiServiceDescriptor.Builder apiServiceDescriptor = ApiServiceDescriptor.newBuilder(); Server server = factory.allocateAddressAndCreate(ImmutableList.of(service), apiServiceDescriptor); return new GrpcFnServer<>(server, service, apiServiceDescriptor.build()); }
From source file:com.palantir.typescript.Builders.java
/** * Forces a full clean rebuild of the given TypeScript project. * * @param project//from w w w. j a va 2s .c o m * the project */ public static void rebuildProject(IProject project) { rebuildProjects(ImmutableList.of(project)); }
From source file:com.wrmsr.wava.java.javac.option.VerboseOption.java
@Override public List<String> getArgs() { return ImmutableList.of("-verbose"); }
From source file:io.prestosql.plugin.tpch.TpchPlugin.java
@Override public Iterable<ConnectorFactory> getConnectorFactories() { return ImmutableList.of(new TpchConnectorFactory()); }
From source file:io.prestosql.plugin.tpcds.TpcdsPlugin.java
@Override public Iterable<ConnectorFactory> getConnectorFactories() { return ImmutableList.of(new TpcdsConnectorFactory()); }
From source file:io.prestosql.plugin.example.ExamplePlugin.java
@Override public Iterable<ConnectorFactory> getConnectorFactories() { return ImmutableList.of(new ExampleConnectorFactory()); }
From source file:com.google.api.services.samples.dfareporting.misc.GetChangeLogsForAdvertiser.java
public static void runExample(Dfareporting reporting, long profileId, long advertiserId) throws Exception { // Limit the fields returned. String fields = "nextPageToken,changeLogs(action,fieldName,oldValue,newValue)"; ChangeLogsListResponse changeLogs;// www . ja v a 2 s . c o m String nextPageToken = null; do { // Create and execute the change logs list request changeLogs = reporting.changeLogs().list(profileId).setObjectIds(ImmutableList.of(advertiserId)) .setObjectType("OBJECT_ADVERTISER").setFields(fields).setPageToken(nextPageToken).execute(); for (ChangeLog changeLog : changeLogs.getChangeLogs()) { System.out.printf("%s: Field \"%s\" from \"%s\" to \"%s\".%n", changeLog.getAction(), changeLog.getFieldName(), changeLog.getOldValue(), changeLog.getNewValue()); } // Update the next page token. nextPageToken = changeLogs.getNextPageToken(); } while (!changeLogs.getChangeLogs().isEmpty() && !Strings.isNullOrEmpty(nextPageToken)); }
From source file:com.spotify.heroic.metric.WriteMetric.java
public static Transform<Throwable, WriteMetric> shardError(final ClusterShard c) { return e -> new WriteMetric(ImmutableList.of(ShardError.fromThrowable(c, e)), ImmutableList.of()); }