List of usage examples for com.google.common.collect Iterables toArray
static <T> T[] toArray(Iterable<? extends T> iterable, T[] array)
From source file:org.jclouds.ec2.binders.BindTagKeysToIndexedFormParams.java
@Override public <R extends HttpRequest> R bindToRequest(R request, Object input) { checkArgument(checkNotNull(input, "input") instanceof Iterable, "This binder is only valid for Iterable<String>"); @SuppressWarnings("unchecked") Iterable<String> keys = (Iterable<String>) input; return AWSUtils.indexStringArrayToFormValuesWithStringFormat(request, "Tag.%s.Key", Iterables.toArray(keys, String.class)); }
From source file:org.jclouds.ec2.options.internal.BaseEC2RequestOptions.java
protected void indexFormValuesWithPrefix(String prefix, Iterable<String> values) { indexFormValuesWithPrefix(prefix, Iterables.toArray(values, String.class)); }
From source file:org.eclipse.viatra.addon.viewers.runtime.zest.sources.ZestContentProvider.java
@Override public Object[] getElements(Object inputElement) { if (state != null) { Iterable<Edge> it = (displayContainment) ? Iterables.concat(state.getEdges(), state.getContainments()) : state.getEdges();/*w ww. ja v a2 s .com*/ return Iterables.toArray(it, Edge.class); } else return new Object[] {}; }
From source file:org.reflecio.guava.ReflectBuilder.java
public Iterable<?> build() { SelectionStrategy<?>[] strategiesArr = Iterables.toArray(strategies, SelectionStrategy.class); return Reflecio.fields(type); }
From source file:org.opentestsystem.shared.monitoringalerting.service.impl.DiscreteIntakeServiceImpl.java
@Override public String[] getDistinctMetricTypes() { return Iterables.toArray( Lists.transform(this.discreteIntakeRepository.findByType(TYPE.METRIC), VALUE_TRANSFORMER), String.class); }
From source file:org.metaborg.intellij.idea.filetypes.MetaborgFileTypeConsumer.java
/** * Consumes the file type with its default extensions. * * @param fileType The file type.//ww w . j a v a2 s . c om */ public void consume(final IMetaborgFileType fileType) { Preconditions.checkNotNull(fileType); consume(fileType, Iterables.toArray(fileType.getExtensions(), String.class)); }
From source file:com.enonic.cms.core.resource.ResourceKey.java
private static String[] normalize(final String[] parts) { final LinkedList<String> normalized = Lists.newLinkedList(); for (final String part : parts) { if (part.equals(".")) { continue; }/*from w w w . j a va 2 s . c o m*/ if (part.equals("..")) { if (!normalized.isEmpty()) { normalized.removeLast(); } continue; } normalized.add(part); } return Iterables.toArray(normalized, String.class); }
From source file:org.immutables.eventual.CompletedModule.java
static ListenableFuture<Module> from(Injector injectingFutures, CompletionCriteria criteria) { final LinkedHashMap<Key<?>, Key<?>> keyMapping = mapUnfutureKeys(injectingFutures); List<ListenableFuture<?>> listOfFutures = getFutureInstances(keyMapping.keySet(), injectingFutures); ListenableFuture<List<Object>> futureOfList = criteria == CompletionCriteria.SUCCESSFUL ? Futures.successfulAsList(listOfFutures) : Futures.allAsList(listOfFutures); return Futures.transform(futureOfList, new Function<List<Object>, Module>() { Key<?>[] keys = Iterables.toArray(keyMapping.values(), Key.class); @Override/*from w w w .j a v a 2s. c om*/ public Module apply(List<Object> instances) { return new CompletedModule(keys, instances.toArray()); } }, MoreExecutors.directExecutor()); }
From source file:org.apache.servicecomb.transport.rest.vertx.accesslog.AccessLogGenerator.java
@SuppressWarnings("unchecked") public AccessLogGenerator(String rawPattern) { List<AccessLogItem<RoutingContext>> accessLogItemList = accessLogPatternParser.parsePattern(rawPattern); accessLogItems = Iterables.toArray(accessLogItemList, AccessLogItem.class); }
From source file:npanday.executable.execution.switches.SwitchFormat.java
public static SwitchFormat fromStringDefinition(String formatDefinition) { String[] args = Iterables.toArray(SPLIT_ON_SEMICOLON.split(formatDefinition), String.class); return new SwitchFormat(args[0].charAt(0), args[1], args[2].charAt(0)); }