List of usage examples for com.google.common.collect FluentIterable from
@Deprecated @CheckReturnValue public static <E> FluentIterable<E> from(FluentIterable<E> iterable)
From source file:org.mayocat.shop.payment.store.memory.MemoryPaymentOperationStore.java
@Override public List<PaymentOperation> findAllForOrderId(final UUID order) { return FluentIterable.from(all()).filter(new Predicate<PaymentOperation>() { @Override/*from w w w . j a v a 2s . c o m*/ public boolean apply(PaymentOperation paymentOperation) { return paymentOperation.getOrderId().equals(order); } }).toList(); }
From source file:ec.tss.tsproviders.sdmx.engine.FluentDom.java
@Deprecated public static FluentIterable<Node> attributes(Node node) { return FluentIterable.from(asList(node.getAttributes())); }
From source file:com.brighttag.agathon.security.Netmask.java
public static ImmutableSet<Netmask> fromCidr(Collection<String> cidrs) { return FluentIterable.from(cidrs).transform(FROM_CIDR).filter(VALID_NETMASKS).toSet(); }
From source file:org.jclouds.osgi.Bundles.java
/** * instantiates the supplied classnames using the bundle classloader, and casts to the supplied type. Any errors are * silently ignored.//from www .jav a2 s .co m * * @return instances that could be instantiated without error. */ public static <T> ImmutableSet<T> instantiateAvailableClasses(Bundle bundle, Iterable<String> classNames, Class<T> type) { checkNotNull(bundle, "bundle"); checkNotNull(classNames, "classNames"); checkNotNull(type, "type"); return FluentIterable.from(classNames).transform(loadClassIfAssignableFrom(bundle, type)).filter(notNull()) .transform(instantiateIfPossible(type)).filter(notNull()).toSet(); }
From source file:org.mayocat.shop.customer.store.memory.MemoryAddressStore.java
@Override public Address findByCustomerIdAndType(final UUID customerId, final String type) { return FluentIterable.from(all()).filter(new Predicate<Address>() { public boolean apply(@Nullable Address input) { return input.getCustomerId().equals(customerId) && input.getType().equals(type); }/*ww w .j a v a 2s .c o m*/ }).first().orNull(); }
From source file:com.b2international.snowowl.core.events.bulk.BulkResponse.java
public <T> FluentIterable<T> getResponses(final Class<T> type) { return FluentIterable.from(getItems()).filter(type); }
From source file:org.mayocat.cms.news.store.memory.MemoryArticleStore.java
@Override public List<Article> findAllPublished(Integer offset, Integer number) { Iterable<Article> allPublished = FluentIterable.from(all()).filter(new Predicate<Article>() { public boolean apply(@Nullable Article input) { return input.getPublished() != null && input.getPublished(); }/* w ww .java 2 s . com*/ }); if (number == 0) { return FluentIterable.from(allPublished).skip(offset).toList(); } return FluentIterable.from(allPublished).skip(offset).limit(number).toList(); }
From source file:com.facebook.buck.jvm.java.autodeps.SymbolExtractor.java
public static Symbols extractSymbols(JavaFileParser javaFileParser, boolean shouldRecordRequiredSymbols, ImmutableSortedSet<Path> absolutePaths) { Set<String> providedSymbols = new HashSet<>(); Set<String> requiredSymbols = new HashSet<>(); Set<String> exportedSymbols = new HashSet<>(); for (Path src : absolutePaths) { String code;//from w w w .j av a2 s .c o m try { code = Files.toString(src.toFile(), Charsets.UTF_8); } catch (IOException e) { throw new RuntimeException(e); } JavaFileParser.JavaFileFeatures features = javaFileParser.extractFeaturesFromJavaCode(code); if (shouldRecordRequiredSymbols) { requiredSymbols.addAll(features.requiredSymbols); exportedSymbols.addAll(features.exportedSymbols); } providedSymbols.addAll(features.providedSymbols); } return new Symbols(providedSymbols, FluentIterable.from(requiredSymbols).filter(SymbolExtractor::isNotABuiltInSymbol), FluentIterable.from(exportedSymbols).filter(SymbolExtractor::isNotABuiltInSymbol)); }
From source file:jetbrains.jetpad.cell.completion.CompletionItems.java
public CompletionItems(Iterable<CompletionItem> items) { myItems.addAll(FluentIterable.from(items).toList()); }
From source file:org.apache.james.mailbox.store.search.comparator.CombinedComparator.java
public static CombinedComparator create(List<Sort> sorts) { Preconditions.checkNotNull(sorts);// w w w.j ava 2 s . c o m Preconditions.checkArgument(!sorts.isEmpty()); return new CombinedComparator(FluentIterable.from(sorts).transform(toComparator()).toList()); }