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(final Iterable<? extends Iterable<? extends T>> inputs) 

Source Link

Document

Combines multiple iterables into a single iterable.

Usage

From source file:org.onos.yangtools.yang.data.impl.schema.transform.base.serializer.ListNodeBaseSerializer.java

@Override
public final Iterable<E> serialize(final ListSchemaNode schema, final N node) {
    return Iterables.concat(Iterables.transform(node.getValue(), new Function<O, Iterable<E>>() {
        @Override/*from w  w  w . ja v a 2s  .  c o m*/
        public Iterable<E> apply(final O input) {
            final Iterable<E> serializedChild = getListEntryNodeSerializer().serialize(schema, input);
            final int size = Iterables.size(serializedChild);

            Preconditions.checkState(size == 1,
                    "Unexpected count of entries  for list serialized from: %s, should be 1, was: %s", input,
                    size);
            return serializedChild;
        }
    }));
}

From source file:cosmos.sql.call.ChildVisitor.java

public Iterable<?> visit(final Function<ChildVisitor, Iterable<?>> callbackFunction,
        final Predicate<ChildVisitor> childFilter) {
    Collection<ChildVisitor> equalities = children.values();
    return Iterables.concat(Iterables.transform(Iterables.filter(equalities, childFilter), callbackFunction));
}

From source file:org.apache.giraph.block_app.framework.block.SequenceBlock.java

@Override
public Iterator<AbstractPiece> iterator() {
    return Iterables.concat(Arrays.asList(blocks)).iterator();
}

From source file:org.isisaddons.wicket.timeline.cpt.ui.TimelineableCollectionAsTimeline.java

@Override
protected Set<String> getTimelineNames(final Collection<ObjectAdapter> entityList) {
    return Sets.newLinkedHashSet(
            Iterables.concat(Iterables.transform(entityList, TimelineableEventProvider.GET_Timeline_NAMES)));
}

From source file:sf.net.experimaestro.manager.scripting.MethodFunction.java

@Override
protected Iterable<MethodDeclaration> declarations() {
    return Iterables.concat(new AbstractList<Iterable<MethodDeclaration>>() {
        @Override/*w  w w.j av a  2 s  .c  om*/
        public Iterable<MethodDeclaration> get(final int index) {
            Group group = groups.get(index);
            return Iterables.transform(group.methods, m -> new MethodDeclaration(group.thisObject, m));
        }

        @Override
        public int size() {
            return groups.size();
        }
    });
}

From source file:org.isisaddons.wicket.fullcalendar2.cpt.ui.CalendarableCollectionAsFullCalendar2.java

@Override
protected Set<String> getCalendarNames(final Collection<ObjectAdapter> entityList) {
    return Sets.newLinkedHashSet(
            Iterables.concat(Iterables.transform(entityList, CalendarableEventProvider.GET_CALENDAR_NAMES)));
}

From source file:org.immutables.generator.Intrinsics.java

@SafeVarargs
public static <T> Iterable<T> $(Iterable<? extends T>... iterables) {
    return Iterables.concat(iterables);
}

From source file:zotmc.collect.delegate.ConcatCollection.java

protected Iterable<E> concatenated() {
    return Iterables.concat(backing());
}

From source file:org.apache.maven.model.building.Result.java

/**
 * Success with warnings./*from   w  w  w . ja  va2 s  .c  o  m*/
 */
public static <T> Result<T> success(T model, Result<?>... results) {
    return success(model, Iterables.concat(Iterables.transform(Arrays.asList(results), GET_PROBLEMS)));
}

From source file:org.polarsys.reqcycle.traceability.types.configuration.typeconfiguration.util.ConfigUtils.java

public static Iterable<CustomType> getCustomTypesUsedInRelations(Configuration config, final String typeId) {
    return Sets.newHashSet(Iterables
            .concat(Iterables.transform(config.getRelations(), new Function<Relation, Iterable<CustomType>>() {
                public Iterable<CustomType> apply(Relation r) {
                    List<CustomType> result = new LinkedList<CustomType>();
                    if (r.getDownstreamType() instanceof CustomType) {
                        CustomType downstreamType = (CustomType) r.getDownstreamType();
                        if (downstreamType.getSuperType().getTypeId().equals(typeId)) {
                            result.add(downstreamType);
                        }/*from w w  w .  j  av a 2 s .  co m*/
                    }
                    if (r.getUpstreamType() instanceof CustomType) {
                        CustomType upstreamType = (CustomType) r.getUpstreamType();
                        if (upstreamType.getSuperType().getTypeId().equals(typeId)) {
                            result.add(upstreamType);
                        }
                    }
                    return result;
                }
            })));
}