Example usage for com.google.common.collect FluentIterable from

List of usage examples for com.google.common.collect FluentIterable from

Introduction

In this page you can find the example usage for com.google.common.collect FluentIterable from.

Prototype

@Deprecated
@CheckReturnValue
public static <E> FluentIterable<E> from(FluentIterable<E> iterable) 

Source Link

Document

Construct a fluent iterable from another fluent iterable.

Usage

From source file:org.jclouds.aws.ec2.xml.DescribeVPCsResponseHandler.java

@Override
public FluentIterable<VPC> getResult() {
    return FluentIterable.from(vpcs.build());
}

From source file:br.com.objectos.way.core.code.jdt.AstReaderResource.java

@Override
void setEnvironment(ASTParser parser) {
    String[] classpathEntries = FluentIterable.from(jarHints).transform(ToJar.INSTANCE).toArray(String.class);
    parser.setEnvironment(classpathEntries, null, null, true);
}

From source file:dagger2.internal.codegen.writer.Snippet.java

@Override
public Set<ClassName> referencedClasses() {
    return FluentIterable.from(types).transformAndConcat(new Function<TypeName, Set<ClassName>>() {
        @Override/*ww  w.  j  a  va2s.c o m*/
        public Set<ClassName> apply(TypeName input) {
            return input.referencedClasses();
        }
    }).toSet();
}

From source file:org.gradle.integtests.fixtures.AvailableJavaHomes.java

public static List<JavaInfo> getAvailableJdks(final Spec<? super JvmInstallation> filter) {
    return FluentIterable.from(getJvms()).filter(new Predicate<JvmInstallation>() {
        @Override/* w w w .  j  a va 2 s. com*/
        public boolean apply(JvmInstallation input) {
            return input.isJdk() && filter.isSatisfiedBy(input);
        }
    }).transform(new Function<JvmInstallation, JavaInfo>() {
        @Override
        public JavaInfo apply(JvmInstallation input) {
            return Jvm.forHome(input.getJavaHome());
        }
    }).toList();
}

From source file:com.gwtplatform.dispatch.rest.processors.resource.ResourceMethodProcessors.java

public List<CodeSnippet> processAll(List<ResourceMethod> methods) {
    return FluentIterable.from(methods).transform(this::process).toList();
}

From source file:io.crate.metadata.TablePartitionInfos.java

@Override
public Iterator<TablePartitionInfo> iterator() {
    return FluentIterable.from(tableInfos).filter(new Predicate<TableInfo>() {
        @Override//from  www .j  a  v a 2 s. c  o m
        public boolean apply(@Nullable TableInfo input) {
            return (input instanceof DocTableInfo) && input.isPartitioned() && input.partitions().size() > 0;
        }
    }).transformAndConcat(new Function<TableInfo, Iterable<? extends TablePartitionInfo>>() {
        @Nullable
        @Override
        public Iterable<? extends TablePartitionInfo> apply(@Nullable TableInfo input) {
            return new TablePartitionInfosIterable((DocTableInfo) input);
        }
    }).iterator();
}

From source file:org.jclouds.dimensiondata.cloudcontroller.compute.functions.OsImageToHardware.java

@Override
public Hardware apply(final OsImage from) {
    HardwareBuilder builder = new HardwareBuilder().ids(from.id()).name(from.name()).hypervisor("vmx")
            .processors(ImmutableList.of(new Processor(from.cpu().count(), from.cpu().coresPerSocket())))
            .ram(from.memoryGb() * 1024);

    if (from.disks() != null) {
        builder.volumes(FluentIterable.from(from.disks()).transform(new Function<Disk, Volume>() {
            @Override//from w  ww .j a v a 2  s  .  c o m
            public Volume apply(Disk disk) {
                return new VolumeBuilder().id(disk.id()).device(String.valueOf(disk.scsiId()))
                        .size(Float.valueOf(disk.sizeGb())).type(Volume.Type.LOCAL).build();
            }
        }).toSet());
    }
    return builder.build();
}

From source file:picard.vcf.processor.VcfFileSegmentGenerator.java

/**
 * Returns a decorated {@link VcfFileSegmentGenerator} that filters out {@link VcfFileSegment}s that have no overlap with the provided
 * {@link OverlapDetector}.//from www  . j a v  a  2  s. c  om
 */
public static <T> VcfFileSegmentGenerator excludingNonOverlaps(final VcfFileSegmentGenerator strategy,
        final OverlapDetector<T> overlaps) {
    return new VcfFileSegmentGenerator() {
        @Override
        public Iterable<VcfFileSegment> forVcf(final File vcf) {
            return FluentIterable.from(strategy.forVcf(vcf)).filter(new Predicate<VcfFileSegment>() {
                @Override
                public boolean apply(final VcfFileSegment segment) {
                    final boolean keep = !overlaps
                            .getOverlaps(new Interval(segment.contig(), segment.start(), segment.stop()))
                            .isEmpty();
                    if (!keep) {
                        LOG.debug(String.format(
                                "Ignoring segment because it does not overlap with detector, %s::%s:%s-%s",
                                segment.vcf().getName(), segment.contig(), segment.start(), segment.stop()));
                    }
                    return keep;
                }
            });
        }
    };
}

From source file:org.liquigraph.core.validation.PersistedChangesetValidator.java

private Collection<String> validateChecksums(Collection<Changeset> declaredChangesets,
        Collection<Changeset> persistedChangesets) {
    Collection<String> errors = newLinkedList();
    for (Changeset declaredChangeset : declaredChangesets) {
        Optional<Changeset> maybePersistedChangeset = FluentIterable.from(persistedChangesets)
                .firstMatch(ChangesetById.BY_ID(declaredChangeset.getId(), declaredChangeset.getAuthor()));

        if (!maybePersistedChangeset.isPresent()) {
            continue;
        }// ww  w . jav  a2  s  .  com

        Changeset persistedChangeset = maybePersistedChangeset.get();
        String declaredChecksum = declaredChangeset.getChecksum();
        String persistedChecksum = persistedChangeset.getChecksum();
        if (!persistedChecksum.equals(declaredChecksum)) {
            errors.add(checksumMismatchError(declaredChangeset, persistedChangeset));
        }
    }
    return errors;

}

From source file:br.com.caelum.vraptor.validator.ErrorList.java

/**
 * Return messages grouped by category. This method can useful if you want to get messages for a specific
 * category.//from   ww w  . j  a va  2  s  .c  om
 */
public Map<String, Collection<Message>> getGrouped() {
    if (grouped == null) {
        grouped = FluentIterable.from(delegate).index(byCategory).asMap();
    }
    return grouped;
}