List of usage examples for com.google.common.collect Iterables concat
public static <T> Iterable<T> concat(final Iterable<? extends Iterable<? extends T>> inputs)
From source file:org.obm.push.HierarchyExporter.java
@Override public BackendFolders getBackendFolders(UserDataRequest udr) { final List<BackendFolders> allFoldersIterables = Lists.newArrayList(); for (PIMBackend backend : backends) { allFoldersIterables.add(backend.getBackendFolders(udr)); }// w w w .j a v a2s . c o m return new BackendFolders() { @Override public Iterator<BackendFolder> iterator() { return Iterables.concat(allFoldersIterables).iterator(); } }; }
From source file:ummisco.gama.opengl.scene.SceneObjects.java
@Override public Iterable<T> getObjects() { return Iterables.concat(objects); }
From source file:org.apache.crunch.io.impl.ReadableDataImpl.java
@Override public Iterable<T> read(TaskInputOutputContext<?, ?, ?, ?> ctxt) throws IOException { final Configuration conf = ctxt.getConfiguration(); final FileReaderFactory<T> readerFactory = getFileReaderFactory(); return Iterables.concat(Lists.transform(paths, new Function<String, Iterable<T>>() { @Override/*from ww w. j a v a 2s. c o m*/ public Iterable<T> apply(@Nullable String input) { Path path = getCacheFilePath(input, conf); try { FileSystem fs = path.getFileSystem(conf); return CompositePathIterable.create(fs, path, readerFactory); } catch (IOException e) { throw new RuntimeException(e); } } })); }
From source file:co.cask.cdap.client.common.ClientTestBase.java
protected void verifyProgramRecords(List<String> expected, Map<ProgramType, List<ProgramRecord>> map) { verifyProgramNames(expected, Lists.newArrayList(Iterables.concat(map.values()))); }
From source file:io.crate.operation.merge.PassThroughPagingIterator.java
@Override public Iterable<TRow> repeat() { Iterable<TRow> repeatMe = storedForRepeat; if (repeatMe == null) { repeatMe = Iterables.concat(this.iterables.build()); this.storedForRepeat = repeatMe; }// w ww . j a va2s . c o m return repeatMe; }
From source file:com.google.devtools.build.lib.rules.android.AndroidAaptActionHelper.java
/** * Returns the artifacts needed as inputs to process the resources/assets. *///from w w w .ja v a2s . c o m private Iterable<Artifact> getInputs() { if (inputs.isEmpty()) { inputs.add(AndroidSdkProvider.fromRuleContext(ruleContext).getAndroidJar()); inputs.add(manifest); Iterables.addAll(inputs, Iterables.concat( Iterables.transform(resourceContainers, new Function<ResourceContainer, Iterable<Artifact>>() { @Override public Iterable<Artifact> apply(ResourceContainer container) { return container.getArtifacts(); } }))); } return inputs; }
From source file:org.apache.provisionr.amazon.activities.AmazonActivity.java
protected List<Instance> collectInstancesFromReservations(List<Reservation> reservation) { /* Make a copy as an ArrayList to force lazy collection evaluation */ List<List<Instance>> allInstances = Lists.transform(reservation, new Function<Reservation, List<Instance>>() { @Override//from w ww .ja v a2 s . com public List<Instance> apply(Reservation reservation) { return reservation.getInstances(); } }); return Lists.newArrayList(Iterables.concat(allInstances)); }
From source file:com.google.gerrit.server.index.PredicateWrapper.java
@Override public ResultSet<ChangeData> read() throws OrmException { final List<ResultSet<ChangeData>> results = Lists.newArrayListWithCapacity(sources.size()); for (ChangeDataSource source : sources) { results.add(source.read());//w w w.j a va 2 s . c o m } return new ResultSet<ChangeData>() { @Override public Iterator<ChangeData> iterator() { // TODO(dborowitz): May return duplicates since moving a document // between indexes is not atomic. return Iterables.concat(results).iterator(); } @Override public List<ChangeData> toList() { return Collections.unmodifiableList(Lists.newArrayList(iterator())); } @Override public void close() { for (ResultSet<ChangeData> rs : results) { rs.close(); } } }; }
From source file:com.facebook.buck.parser.DefaultParser.java
@SuppressWarnings("unused") @Override//from ww w .ja va 2s . c o m protected ImmutableSet<BuildTarget> collectBuildTargetsFromTargetNodeSpecs(ParsingContext parsingContext, PerBuildState state, Iterable<? extends TargetNodeSpec> targetNodeSpecs, TargetConfiguration targetConfiguration, boolean excludeConfigurationTargets) throws InterruptedException { TargetNodeProviderForSpecResolver<TargetNode<?>> targetNodeProvider = createTargetNodeProviderForSpecResolver( state); return ImmutableSet.copyOf( Iterables.concat(targetSpecResolver.resolveTargetSpecs(parsingContext.getCell(), targetNodeSpecs, // This parser doesn't support configured targets, explicitly erase information // about target configuration EmptyTargetConfiguration.INSTANCE, (buildTarget, targetNode, targetType) -> applyDefaultFlavors(buildTarget, targetNode, targetType, parsingContext.getApplyDefaultFlavorsMode()), targetNodeProvider, (spec, nodes) -> spec.filter(nodes)))); }
From source file:blackboard.plugin.hayabusa.controller.ProviderRestController.java
@RequestMapping(value = "commands", method = RequestMethod.GET) @ResponseStatus(value = HttpStatus.OK)/*from w w w . jav a 2 s. com*/ public @ResponseBody CommandResponse getCommands() { List<Provider> providers = _providerService.getProviders(); List<Iterable<Command>> commands = Lists.newArrayList(); for (Provider provider : providers) { commands.add(provider.getCommands()); } CommandList commandList = new CommandList(); Iterables.addAll(commandList, Iterables.concat(commands)); return new CommandResponse(commandList); }