Example usage for com.google.common.collect Iterables concat

List of usage examples for com.google.common.collect Iterables concat

Introduction

In this page you can find the example usage for com.google.common.collect Iterables concat.

Prototype

public static <T> Iterable<T> concat(Iterable<? extends T> a, Iterable<? extends T> b) 

Source Link

Document

Combines two iterables into a single iterable.

Usage

From source file:ca.travelagency.persistence.query.Conditions.java

List<Condition> getConditions() {
    return Lists.newArrayList(Iterables.concat(getAndConditions(), getOrConditions()));
}

From source file:org.gradle.api.internal.tasks.compile.incremental.IncrementalCompilationInitializer.java

public void initializeCompilation(JavaCompileSpec spec, Collection<String> staleClasses) {
    if (staleClasses.isEmpty()) {
        spec.setSource(new SimpleFileCollection());
        return; //do nothing. No classes need recompilation.
    }/*from   ww w  .j  ava  2s. c  o m*/

    PatternSet classesToDelete = new PatternSet();
    PatternSet sourceToCompile = new PatternSet();

    preparePatterns(staleClasses, classesToDelete, sourceToCompile);

    //selectively configure the source
    spec.setSource(spec.getSource().getAsFileTree().matching(sourceToCompile));
    //since we're compiling selectively we need to include the classes compiled previously
    spec.setClasspath(Iterables.concat(spec.getClasspath(), asList(spec.getDestinationDir())));
    //get rid of stale files
    FileTree deleteMe = fileOperations.fileTree(spec.getDestinationDir()).matching(classesToDelete);
    fileOperations.delete(deleteMe);
}

From source file:org.s23m.cell.communication.xml.model.schemainstance.Category.java

@Override
public final Iterable<? extends Node> getChildren() {
    return Iterables.concat(ImmutableList.of(semanticIdentity, category), getAdditionalChildren());
}

From source file:org.trancecode.collection.TcIterables.java

public static <T> Iterable<T> prepend(final Iterable<T> iterable, final T... elements) {
    return Iterables.concat(ImmutableList.copyOf(elements), iterable);
}

From source file:org.eclipse.sirius.diagram.tools.internal.validation.description.constraints.EdgeMappingCycleConstraint.java

@Override
public IStatus validate(IValidationContext ctx) {
    EObject eObj = ctx.getTarget();//from   ww  w  . j ava2s  .  c  o m
    EMFEventType eventType = ctx.getEventType();
    // In the case of batch mode.
    if (eventType == EMFEventType.NULL) {
        Resource eObjResource = eObj.eResource();
        if (eObjResource != null && eObjResource.getResourceSet() != null && eObj instanceof EdgeMapping) {
            EdgeMapping edgeMapping = (EdgeMapping) eObj;
            boolean findCycle = hasCycle(edgeMapping, Sets.<EdgeMapping>newLinkedHashSet(),
                    Sets.<EdgeMapping>newLinkedHashSet(Iterables.concat(
                            Iterables.filter(edgeMapping.getSourceMapping(), EdgeMapping.class),
                            Iterables.filter(edgeMapping.getTargetMapping(), EdgeMapping.class))));
            if (findCycle) {
                return ctx.createFailureStatus(new Object[] { edgeMapping, edgeMapping.getName() });
            }
        }
    }
    return ctx.createSuccessStatus();
}

From source file:ratpack.file.internal.DefaultFileHttpTransmitter.java

private static ImmutableSet<String> defaultExcludedMimeTypes(MimeTypes mimeTypes) {
    return ImmutableSet
            .copyOf(Iterables.concat(Iterables.filter(mimeTypes.getKnownMimeTypes(), new Predicate<String>() {
                @Override//from w w w  . jav a 2  s  .co  m
                public boolean apply(String type) {
                    return (type.startsWith("image/") || type.startsWith("audio/") || type.startsWith("video/"))
                            && !type.endsWith("+xml");
                }
            }), ImmutableSet.of("application/compress", "application/zip", "application/gzip")));
}

From source file:com.torodb.core.metrics.Hierarchy.java

public Hierarchy(Hierarchy parent, String key, String value) {
    checkName(key);/*from   w ww  .  j a  va  2  s . co m*/
    checkName(value);

    this.list = ImmutableList.copyOf(Iterables.concat(parent.asList(),
            Collections.singleton(new AbstractMap.SimpleEntry<>(key, value))));
}

From source file:com.b2international.snowowl.snomed.datastore.index.change.ConstraintChangeProcessor.java

@Override
public void process(ICDOCommitChangeSet commitChangeSet, RevisionSearcher searcher) {

    Set<AttributeConstraint> newConstraints = newHashSet();
    Set<AttributeConstraint> changedConstraints = newHashSet();

    for (ConceptModelComponent component : Iterables.concat(
            commitChangeSet.getNewComponents(ConceptModelPredicate.class),
            commitChangeSet.getNewComponents(ConceptSetDefinition.class))) {

        final AttributeConstraint constraint = ConceptModelUtils.getContainerConstraint(component);
        if (commitChangeSet.getNewComponents().contains(constraint)) {
            newConstraints.add(constraint);
        } else {//from w w w. j  av  a 2  s .c  om
            changedConstraints.add(constraint);
        }
    }

    for (ConceptModelComponent component : Iterables.concat(
            commitChangeSet.getDirtyComponents(ConceptModelPredicate.class),
            commitChangeSet.getDirtyComponents(ConceptSetDefinition.class))) {

        final AttributeConstraint constraint = ConceptModelUtils.getContainerConstraint(component);
        changedConstraints.add(constraint);
    }

    for (AttributeConstraint newConstraint : newConstraints) {
        indexNewRevision(newConstraint.cdoID(), SnomedConstraintDocument.builder(newConstraint).build());
    }

    for (AttributeConstraint changedConstraint : changedConstraints) {
        indexChangedRevision(changedConstraint.cdoID(),
                SnomedConstraintDocument.builder(changedConstraint).build());
    }

    deleteRevisions(SnomedConstraintDocument.class,
            commitChangeSet.getDetachedComponents(MrcmPackage.Literals.ATTRIBUTE_CONSTRAINT));
}

From source file:org.thiesen.collections.set.impl.ImmutableSet.java

@Override
public ImmutableSet<E> append(final E value) {
    return copyOf(Iterables.concat(this, Collections.singleton(value)));
}

From source file:org.summer.dsl.model.ui.notification.LayeredTypeResourceDescription.java

public Iterable<IEObjectDescription> getExportedObjects() {
    return Iterables.concat(delegate.getExportedObjects(), additionallyExported);
}