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.jclouds.glesys.functions.ParseTemplatesFromHttpResponse.java
public FluentIterable<OSTemplate> apply(HttpResponse response) { checkNotNull(response, "response"); Map<String, Set<OSTemplate>> toParse = parser.apply(response); checkNotNull(toParse, "parsed result from %s", response); return FluentIterable.from(Iterables.concat(toParse.values())); }
From source file:org.richfaces.cdk.templatecompiler.el.types.ComplexType.java
@Override public Iterable<JavaImport> getRequiredImports() { Iterable<JavaImport> imports = Iterables .concat(Iterables.transform(Arrays.asList(typeArguments), RequireImports.IMPORTS_TRANSFORM)); Set<JavaImport> result = Sets .newLinkedHashSet(Iterables.concat(clearComponentType.getRequiredImports(), imports)); return result; }
From source file:org.jclouds.aws.ec2.util.EC2Utils.java
public static Iterable<RunningInstance> getAllRunningInstancesInRegion(InstanceClient client, String region, String id) {//from w w w . ja v a 2 s .c om return Iterables.concat(client.describeInstancesInRegion(region, id)); }
From source file:org.jclouds.glesys.functions.ParseServerTemplatesFromHttpResponse.java
public Set<ServerTemplate> apply(HttpResponse response) { checkNotNull(response, "response"); Map<String, Set<ServerTemplate>> toParse = parser.apply(response); checkNotNull(toParse, "parsed result from %s", response); return ImmutableSet.copyOf(Iterables.concat(toParse.values())); }
From source file:org.opentestsystem.authoring.testauth.service.impl.ItemMetadataKeysServiceImpl.java
@Override public void loadTibItemImportIntoItemMetadataKeys(final String assessmentId, final List<TibItem> tibItemList) { checkForLockedAssessment(assessmentId); final Set<String> metadataKeys = Sets .newHashSet(Iterables.concat(Multimaps.index(tibItemList, TIBITEM_METADATA_KEYS).asMap().keySet())); ItemMetadataKeys itemMetadataKeys = getItemMetadataKeysByAssessment(assessmentId); if (itemMetadataKeys == null) { itemMetadataKeys = new ItemMetadataKeys(); itemMetadataKeys.setAssessmentId(assessmentId); itemMetadataKeys.setItemMetadataKeys(metadataKeys); } else {//from ww w . j a v a 2s .c o m itemMetadataKeys.getItemMetadataKeys().addAll(metadataKeys); } try { this.itemMetadataKeysRepository.save(itemMetadataKeys); } catch (final DuplicateKeyException dke) { throw new LocalizedException("itemMetadataKeys.already.exists", new String[] {}, dke); } }
From source file:eu.numberfour.n4js.scoping.utils.CompositeScope.java
@Override public Iterable<IEObjectDescription> getElements(QualifiedName name) { return Iterables.concat(Arrays.stream(childScopes).map(currScope -> currScope.getElements(name)) .collect(Collectors.toList())); }
From source file:org.apache.giraph.block_app.framework.block.RepeatUntilBlock.java
@Override public Iterator<AbstractPiece> iterator() { // nCopies uses constant memory, creating a looped list with single element final Iterator<AbstractPiece> repeatIterator = Iterables.concat(Collections.nCopies(repeatTimes, block)) .iterator();/* w w w . j a va2 s . co m*/ return new AbstractIterator<AbstractPiece>() { @Override protected AbstractPiece computeNext() { if (Boolean.TRUE.equals(toQuit.get()) || !repeatIterator.hasNext()) { return endOfData(); } return repeatIterator.next(); } }; }
From source file:de.kussm.direction.Directions.java
public Directions repeat(int n) { return new Directions(Iterables.concat(Iterables.limit(Iterables.cycle(directions), n))); }
From source file:org.jon.ivmark.graphit.tinkerpop.blueprints.BlueprintsNode.java
@Override public Iterable<Edge> getEdges(Direction direction, String... labels) { if (labels.length == 1) { return edgesRepo.getEdges(nodeId, direction, labels[0]); }/*from w ww.j a v a 2s. co m*/ List<Iterable<Edge>> iterables = new ArrayList<Iterable<Edge>>(); for (String label : getLabels(labels)) { Iterable<Edge> edges = edgesRepo.getEdges(nodeId, direction, label); iterables.add(edges); } return Iterables.concat(iterables); }
From source file:org.apache.maven.model.building.Result.java
public static <T> Result<T> error(Result<?>... results) { return error(Iterables.concat(Iterables.transform(Arrays.asList(results), GET_PROBLEMS))); }