public CommandLineParameters clone() { CommandLineParameters ret; try { ret = (CommandLineParameters) super.clone(); } catch (CloneNotSupportedException e) { return null; } if (this.routerIds != null) { ret.routerIds = Lists.newArrayList(); ret.routerIds.addAll(this.routerIds); } return ret; }
@Override public void metricsHeartbeat(MetricsHeartbeatPRequest request, StreamObserver<MetricsHeartbeatPResponse> responseObserver) { RpcUtils.call(LOG, (RpcUtils.RpcCallableThrowsIOException<MetricsHeartbeatPResponse>) () -> { List<Metric> metrics = Lists.newArrayList(); for (alluxio.grpc.Metric metric : request.getOptions().getMetricsList()) { Metric parsed = Metric.fromProto(metric); metrics.add(parsed); } mMetricsMaster.clientHeartbeat(request.getClientId(), request.getHostname(), metrics); return MetricsHeartbeatPResponse.getDefaultInstance(); }, "metricsHeartbeat", "request=%s", responseObserver, request); } }
List<Object> run(List<Object[]> values) throws Exception { Object r1 = runComplete(values); Object r2 = runPartialFinal(values); Object r3 = runPartial2Final(values); return Lists.newArrayList(r1, r2, r3); }
return false; } else { List<TransitStop> bestStops = Lists.newArrayList(); List<StreetEdge> bestEdges = Lists.newArrayList();
OrderedPermutationIterator(List<E> list, Comparator<? super E> comparator) { this.nextPermutation = Lists.newArrayList(list); this.comparator = comparator; }
OrderedPermutationIterator(List<E> list, Comparator<? super E> comparator) { this.nextPermutation = Lists.newArrayList(list); this.comparator = comparator; }
/** * Create new builder with empty resources. * * @param subResourceModel {@code true} if resource model created by this builder will be sub resource model, * {@code false} if it is a application root resource model. */ public Builder(boolean subResourceModel) { this.resources = Lists.newArrayList(); this.subResourceModel = subResourceModel; }
OrderedPermutationIterator(List<E> list, Comparator<? super E> comparator) { this.nextPermutation = Lists.newArrayList(list); this.comparator = comparator; }
/** * Create new builder with empty resources. * * @param subResourceModel {@code true} if resource model created by this builder will be sub resource model, * {@code false} if it is a application root resource model. */ public Builder(boolean subResourceModel) { this.resources = Lists.newArrayList(); this.subResourceModel = subResourceModel; }
/** * Converts an iterable into a collection. If the iterable is already a * collection, it is returned. Otherwise, an {@link java.util.ArrayList} is * created with the contents of the iterable in the same iteration order. */ private static <E> Collection<E> toCollection(Iterable<E> iterable) { return (iterable instanceof Collection) ? (Collection<E>) iterable : Lists.newArrayList(iterable.iterator()); }
/** * Converts an iterable into a collection. If the iterable is already a * collection, it is returned. Otherwise, an {@link java.util.ArrayList} is * created with the contents of the iterable in the same iteration order. */ private static <E> Collection<E> toCollection(Iterable<E> iterable) { return (iterable instanceof Collection) ? (Collection<E>) iterable : Lists.newArrayList(iterable.iterator()); }
@Override public List<String> getHeaderValues(final String name) { ArrayList<String> list = Lists.newArrayList(); for (String header : clientRequest.getStringHeaders().get(name)) { list.add(header); } return list; }
@Override public <T> T[] toArray(T[] array) { return Lists.newArrayList(iterator()).toArray(array); } }
@Override public Object[] toArray() { // creating an ArrayList so filtering happens once return Lists.newArrayList(iterator()).toArray(); }
@Override public List<? extends ResourceModelComponent> getComponents() { List<ResourceModelComponent> components = Lists.newArrayList(); components.addAll(resources); components.addAll(getRuntimeResourceModel().getRuntimeResources()); return components; }
@SuppressWarnings("unchecked") private static <T> List<MediaType> getMessageBodyWorkersMediaTypesByType( final List<? extends AbstractEntityProviderModel<T>> workerModels) { final Set<MediaType> mediaTypeSet = Sets.newHashSet(); for (final AbstractEntityProviderModel<T> model : workerModels) { mediaTypeSet.addAll(model.declaredTypes()); } final List<MediaType> mediaTypes = Lists.newArrayList(mediaTypeSet); Collections.sort(mediaTypes, MediaTypes.PARTIAL_ORDER_COMPARATOR); return mediaTypes; }
/** * Creates new instance. */ public OptionsMethodProcessor() { methodList = Lists.newArrayList(); methodList.add(new ModelProcessorUtil.Method(HttpMethod.OPTIONS, MediaType.WILDCARD_TYPE, MediaType.TEXT_PLAIN_TYPE, PlainTextOptionsInflector.class)); methodList.add(new ModelProcessorUtil.Method(HttpMethod.OPTIONS, MediaType.WILDCARD_TYPE, MediaType.WILDCARD_TYPE, GenericOptionsInflector.class)); }
/** * Creates new runtime resource model from the list of resources. * * @param resources List of all resource that should be base for the model. */ public RuntimeResourceModel(List<Resource> resources) { this.runtimeResources = Lists.newArrayList(); for (RuntimeResource.Builder builder : getRuntimeResources(resources)) { runtimeResources.add(builder.build(null)); } Collections.sort(runtimeResources, RuntimeResource.COMPARATOR); }
/** * Create new common scope provider with injected {@link Configuration configuration} and * {@link ServiceLocator HK2 service locator}. */ @Inject public CommonScopeProvider(final Configuration config, final ServiceLocator serviceLocator) { this.config = config; this.resolvers = Lists.newArrayList(Providers.getAllProviders( serviceLocator, ScopeResolver.class, new RankedComparator<ScopeResolver>())); }
private static List<Registration> getInitParamDeclaredRegistrations(final ServletContext context, final Class<? extends Application> clazz) { final List<Registration> registrations = Lists.newArrayList(); collectJaxRsRegistrations(context.getServletRegistrations(), registrations, clazz); collectJaxRsRegistrations(context.getFilterRegistrations(), registrations, clazz); return registrations; }