List of usage examples for com.google.common.collect ImmutableList copyOf
public static <E> ImmutableList<E> copyOf(E[] elements)
From source file:com.google.errorprone.refaster.UAnyOf.java
public static UAnyOf create(UExpression... expressions) { return create(ImmutableList.copyOf(expressions)); }
From source file:com.google.caliper.bridge.StartVmRequest.java
/** Creates a new {@link StartVmRequest}. */ public static StartVmRequest create(UUID vmId, Iterable<String> command) { return new AutoValue_StartVmRequest(vmId, ImmutableList.copyOf(command), UUID.randomUUID(), UUID.randomUUID());//from w w w . j av a 2 s .c o m }
From source file:com.shigengyu.hyperion.core.WorkflowTransitionSet.java
public static WorkflowTransitionSet copyOf(Iterable<WorkflowTransition> transitions) { return new WorkflowTransitionSet(ImmutableList.copyOf(transitions)); }
From source file:zotmc.collect.delegate.ConcatCollection.java
public static <E> ConcatCollection<E> af(final Collection<E>... backing) { return af(ImmutableList.copyOf(backing)); }
From source file:com.facebook.buck.cli.JavaUtilLogHandlers.java
public static Optional<ConsoleHandler> getConsoleHandler() { // We can't stop someone from mutating this array, but we can minimize the chance. ImmutableList<Handler> handlers = ImmutableList.copyOf(Logger.getLogger("").getHandlers()); for (Handler handler : handlers) { if (handler instanceof ConsoleHandler) { return Optional.of((ConsoleHandler) handler); } else if (handler instanceof Callable<?>) { // com.facebook.buck.cli.bootstrapper.ConsoleHandler is not // visible to us, so thunk it through Callable<Handler> so // we can get at the real ConsoleHandler. Callable<?> callable = (Callable<?>) handler; try { Object innerHandler = callable.call(); if (innerHandler instanceof ConsoleHandler) { return Optional.of((ConsoleHandler) innerHandler); }/*ww w . j a v a 2 s . c o m*/ } catch (Exception e) { throw new RuntimeException(e); } } } // If we hit this, something has gone wrong and we can't find the // ConsoleHandler from the list of registered log handlers. // // This means SuperConsole will not be notified when we print log // messages to console, so it will not disable itself, causing log // console logs to collide with SuperConsole output. System.err.println("WARNING: Cannot find ConsoleHandler log handler. " + "Logs printed to console will likely be lost."); return Optional.absent(); }
From source file:org.gradle.internal.component.external.model.ImmutableCapabilities.java
public static ImmutableCapabilities of(List<? extends Capability> capabilities) { return new ImmutableCapabilities(ImmutableList.copyOf(capabilities)); }
From source file:com.spotify.heroic.metric.BackendKeyCriteria.java
public static BackendKeyCriteria and(final Iterable<BackendKeyCriteria> criterias) { return new And(ImmutableList.copyOf(criterias)); }
From source file:com.netflix.metacat.common.type.TypeUtils.java
/** * parameterizedTypeName./*from w w w .ja v a 2 s. com*/ * * @param baseType baseType * @param argumentNames args * @return type signature */ public static TypeSignature parameterizedTypeSignature(final TypeEnum baseType, final TypeSignature... argumentNames) { return new TypeSignature(baseType, ImmutableList.copyOf(argumentNames), ImmutableList.of()); }
From source file:org.eclipse.buildship.core.util.string.StringUtils.java
/** * Removes adjacent duplicates.//from w ww . j ava 2 s . c om * * @param elements the elements to filter * @return the result with adjacent duplicates removed */ public static ImmutableList<String> removeAdjacentDuplicates(List<String> elements) { Deque<String> result = Lists.newLinkedList(); for (String element : elements) { if (result.isEmpty() || !result.getLast().equals(element)) { result.addLast(element); } } return ImmutableList.copyOf(result); }
From source file:org.apache.calcite.tools.RuleSets.java
/** Creates a rule set with a given array of rules. */ public static RuleSet ofList(RelOptRule... rules) { return new ListRuleSet(ImmutableList.copyOf(rules)); }