List of usage examples for com.google.common.collect Iterables concat
public static <T> Iterable<T> concat(Iterable<? extends T> a, Iterable<? extends T> b)
From source file:com.eucalyptus.reporting.export.Export.java
public static ReportingExport export(final Date startDate, final Date endDate, final boolean includeDependencies) { final ReportingExport export = new ReportingExport(); final Conjunction criterion = Restrictions.conjunction(); if (startDate != null) { criterion.add(Restrictions.ge(CREATION_TIMESTAMP, startDate)); }//ww w. j a va 2 s. c o m if (endDate != null) { criterion.add(Restrictions.lt(CREATION_TIMESTAMP, endDate)); } final List<ReportingEventSupport> actions = Lists.newArrayList(); export.addUsage( Iterables.filter( Iterables.transform( iterableExporter(criterion, getUsageClasses(), Collections.<ReportingEventSupport>emptyList(), includeDependencies), ExportUtils.toExportUsage(includeDependencies ? actions : null)), Predicates.notNull())); export.addActions( Iterables .transform( Iterables.concat(actions, iterableExporter(criterion, getEventClasses(), actions, includeDependencies)), Functions.compose(userAccountDecorator(), ExportUtils.toExportAction()))); return export; }
From source file:cc.kave.commons.pointsto.analysis.utils.GenericNameUtils.java
public static IMethodName eraseGenericInstantiations(IMethodName method) { if (!method.getIdentifier().contains(INSTANTIATION_ARROW)) { return method; }// w ww .j a va2s . com List<IParameterName> parameters = method.getParameters(); List<ITypeName> parameterTypes = new ArrayList<>(parameters.size()); for (IParameterName parameter : parameters) { parameterTypes.add(parameter.getValueType()); } return Names.newMethod(replaceTypes(method.getIdentifier(), Iterables .concat(Arrays.asList(method.getReturnType(), method.getDeclaringType()), parameterTypes))); }
From source file:org.richfaces.cdk.templatecompiler.statements.SwitchStatement.java
@Override public Iterable<JavaImport> getRequiredImports() { return Iterables.concat(super.getRequiredImports(), statement.getRequiredImports()); }
From source file:org.eclipse.smarthome.io.rest.core.link.ItemChannelLinkResource.java
@GET @Produces(MediaType.APPLICATION_JSON)/*from w w w . ja v a2 s .c o m*/ @ApiOperation(value = "Gets all available links.", response = ItemChannelLinkDTO.class, responseContainer = "Collection") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK") }) public Response getAll() { Collection<ItemChannelLink> channelLinks = itemChannelLinkRegistry.getAll(); Collection<ItemThingLink> thingLinks = itemThingLinkRegistry.getAll(); return Response.ok(toBeans(Iterables.concat(channelLinks, thingLinks))).build(); }
From source file:org.apache.cassandra.db.index.sasi.conf.view.View.java
public View(ColumnIndex index, AbstractType<?> keyValidator, Collection<SSTableIndex> currentView, Collection<SSTableReader> oldSSTables, Set<SSTableIndex> newIndexes) { Map<Descriptor, SSTableIndex> newView = new HashMap<>(); AbstractType<?> validator = index.getValidator(); TermTree.Builder termTreeBuilder = (validator instanceof AsciiType || validator instanceof UTF8Type) ? new PrefixTermTree.Builder(index.getMode().mode, validator) : new RangeTermTree.Builder(index.getMode().mode, validator); List<Interval<ByteBuffer, SSTableIndex>> keyIntervals = new ArrayList<>(); for (SSTableIndex sstableIndex : Iterables.concat(currentView, newIndexes)) { SSTableReader sstable = sstableIndex.getSSTable(); if (oldSSTables.contains(sstable) || sstable.isMarkedCompacted() || newView.containsKey(sstable.descriptor)) { sstableIndex.release();//from www . j a v a 2 s.co m continue; } newView.put(sstable.descriptor, sstableIndex); termTreeBuilder.add(sstableIndex); keyIntervals.add(Interval.create(sstableIndex.minKey(), sstableIndex.maxKey(), sstableIndex)); } this.view = newView; this.termTree = termTreeBuilder.build(); this.keyIntervalTree = IntervalTree.build(keyIntervals, keyValidator); if (keyIntervalTree.intervalCount() != termTree.intervalCount()) throw new IllegalStateException( String.format("mismatched sizes for intervals tree for keys vs terms: %d != %d", keyIntervalTree.intervalCount(), termTree.intervalCount())); }
From source file:org.eclipse.xtext.common.types.ui.notification.LayeredTypeResourceDescription.java
@Override public Iterable<IEObjectDescription> getExportedObjectsByType(final EClass type) { Iterable<IEObjectDescription> additionallyFiltered = Iterables.filter(additionallyExported, new Predicate<IEObjectDescription>() { @Override//from w w w. j a v a2s .co m public boolean apply(IEObjectDescription input) { return EcoreUtil2.isAssignableFrom(type, input.getEClass()); } }); return Iterables.concat(delegate.getExportedObjectsByType(type), additionallyFiltered); }
From source file:net.derquinse.common.meta.MetaFlag.java
/** * Returns a predicate that evaluates to {@code true} if this flag and each of the provided * components evaluates to {@code true}. The components are evaluated in order (after the flag), * and evaluation will be "short-circuited" as soon as a false predicate is found. It defensively * copies the iterable passed in, so future changes to it won't alter the behavior of this * predicate./* w w w . j a v a 2s . c om*/ */ public final Predicate<C> and(Iterable<? extends Predicate<? super C>> components) { return Predicates.and(Iterables.concat(ImmutableList.of(this), components)); }
From source file:com.google.devtools.build.lib.rules.android.ResourceContainer.java
public Iterable<Artifact> getArtifacts() { return Iterables.concat(getAssets(), getResources()); }
From source file:com.isotrol.impe3.api.PathSegmentsTransformers.java
/** * Returns a new transformer that appends an extension to the last segment of the provided path. * @param extension Extension to append. * @return The requested transformer.//from ww w .j a v a2 s .c om */ public static Function<PathSegments, PathSegments> extension(final String extension) { if (extension == null || extension.length() == 0) { return Functions.identity(); } return new Function<PathSegments, PathSegments>() { public PathSegments apply(PathSegments input) { if (input == null || input.isEmpty()) { return input; } String last = input.last(); if (last == null || last.length() == 0) { return input; } last = new StringBuilder(last).append('.').append(extension).toString(); return PathSegments.of(false, Iterables.concat(input.consumeLast(), ImmutableList.of(last))); } public String toString() { return String.format("Extension transformer: %s", extension); }; }; }
From source file:org.sonar.java.model.expression.IdentifierTreeImpl.java
@Override public Iterable<Tree> children() { return Iterables.concat(annotations, Collections.singletonList(nameToken)); }