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:io.ytcode.reflect.Filterable.java
public final F filter(Predicate<E> p) { return with(FluentIterable.from(set).filter(p).toSet()); }
From source file:org.eclipse.buildship.ui.launch.SelectionJavaElementResolver.java
@Override protected Collection<IJavaElement> findJavaElements() { return FluentIterable.from(this.adaptables).transform(new Function<Object, IJavaElement>() { @Override//from w ww .j a va2 s .c o m @SuppressWarnings({ "cast", "RedundantCast" }) public IJavaElement apply(Object input) { return (IJavaElement) Platform.getAdapterManager().getAdapter(input, IJavaElement.class); } }).filter(Predicates.notNull()).toList(); }
From source file:org.stuartgunter.dropwizard.cassandra.CassandraResource.java
@GET @Path("/query") public List<String> query() { final ResultSet resultSet = session.execute("SELECT * FROM SYSTEM.SCHEMA_COLUMNFAMILIES;"); return FluentIterable.from(resultSet.all()).transform(new Function<Row, String>() { @Override/*from w w w.ja v a 2s . c o m*/ public String apply(Row input) { return input.getString(0); } }).toList(); }
From source file:org.mayocat.shop.billing.store.memory.MemoryOrderStore.java
public List<Order> findAllPaidOrAwaitingPayment(Integer number, Integer offset) { if (number == 0) { return FluentIterable.from(all()).filter(paidOrAwaitingPayment).skip(offset).toList(); }/* w w w . j ava2 s .c o m*/ return FluentIterable.from(all()).filter(paidOrAwaitingPayment).skip(offset).limit(number).toList(); }
From source file:io.gravitee.gateway.core.reactor.RouteMatcher.java
public Api match(final Request request) { // Matching rules: // - Context Path // - Virtual host (using HOST header) return FluentIterable.from(registry.listAll()).firstMatch(Predicates.and(new Predicate<Api>() { @Override/*ww w.j av a 2s .com*/ public boolean apply(final Api api) { return request.path().startsWith(api.getPublicURI().getPath()); } }, new Predicate<Api>() { @Override public boolean apply(Api api) { return api.getPublicURI().getHost().equalsIgnoreCase(request.headers().get(HttpHeaders.HOST)); } })).orNull(); }
From source file:net.sourceforge.fenixedu.domain.accessControl.DepartmentPresidentStrategy.java
@Override public Set<User> getMembers() { return FluentIterable.from(Bennu.getInstance().getDepartmentsSet()) .transform(new Function<Department, User>() { @Override//w w w .j ava 2 s. c om public User apply(Department input) { return input.getCurrentDepartmentPresident().getUser(); } }).filter(Predicates.notNull()).toSet(); }
From source file:springfox.documentation.schema.property.ModelPropertiesKeyGenerator.java
@Override public Object generate(Object target, Method method, Object... params) { Optional<ResolvedType> type = FluentIterable.from(newArrayList(params)).filter(ResolvedType.class).first(); Optional<ModelContext> context = FluentIterable.from(newArrayList(params)).filter(ModelContext.class) .first();//w w w.j ava 2 s . c o m if (!type.isPresent()) { throw new IllegalArgumentException( "Key generator can only be used where atleast one parameter is of type " + "ResolvedType"); } StringBuilder sb = new StringBuilder(); sb.append(type.get().toString()); sb.append(context.transform(returnTypeComponent()).or("")); LOG.info("Cache key generated: {}", sb.toString()); return sb.toString(); }
From source file:com.google.caliper.runner.worker.WorkerSpec.java
protected WorkerSpec(Target target, UUID id, Object... args) { this(target, id, FluentIterable.from(args).transform(toStringFunction())); }
From source file:com.example.repository.MapBackedRepository.java
public List<V> where(Predicate<V> criteria) { return FluentIterable.from(service.values()).filter(criteria).toList(); }
From source file:org.androidtransfuse.AnnotationProcessorBase.java
/** * Gets the supported annotations from the @SupportedAnnotations annotation, which deals with classes instead of * strings./* ww w .j av a2 s . com*/ * * @return Set of supported annotation names */ @Override public Set<String> getSupportedAnnotationTypes() { Class<? extends Annotation>[] supportedAnnotations = getClass().getAnnotation(SupportedAnnotations.class) .value(); return FluentIterable.from(Arrays.asList(supportedAnnotations)).transform(new ClassToNameTransform()) .toSet(); }