@Override public Set<String> getSupportedAnnotationTypes() { return FluentIterable.from(super.getSupportedAnnotationTypes()) .append(CustomImmutableAnnotations.annotations()) .toSet(); }
public void testAppend_emptyList() { FluentIterable<Integer> result = FluentIterable.<Integer>from(asList(1, 2, 3)).append(Lists.<Integer>newArrayList()); assertEquals(asList(1, 2, 3), Lists.newArrayList(result)); }
public void testAppend_nullPointerException() { try { FluentIterable<Integer> unused = FluentIterable.<Integer>from(asList(1, 2)).append((List<Integer>) null); fail("Appending null iterable should throw NPE."); } catch (NullPointerException expected) { } }
public void testFromArrayAndAppend() { FluentIterable<TimeUnit> units = FluentIterable.from(TimeUnit.values()).append(TimeUnit.SECONDS); }
public void testAppend_toEmpty() { FluentIterable<Integer> result = FluentIterable.<Integer>of().append(Lists.newArrayList(1, 2, 3)); assertEquals(asList(1, 2, 3), Lists.newArrayList(result)); }
public void testAppend() { FluentIterable<Integer> result = FluentIterable.<Integer>from(asList(1, 2, 3)).append(Lists.newArrayList(4, 5, 6)); assertEquals(asList(1, 2, 3, 4, 5, 6), Lists.newArrayList(result)); assertEquals("[1, 2, 3, 4, 5, 6]", result.toString()); result = FluentIterable.<Integer>from(asList(1, 2, 3)).append(4, 5, 6); assertEquals(asList(1, 2, 3, 4, 5, 6), Lists.newArrayList(result)); assertEquals("[1, 2, 3, 4, 5, 6]", result.toString()); }
/** * Gets all (public) methods by name using reflection */ private static Set<Method> methodsByName(Class<?> type, final String name) { return FluentIterable .from(Arrays.asList(type.getDeclaredMethods())) .append(Arrays.asList(type.getMethods())) .filter(new Predicate<Method>() { @Override public boolean apply(Method method) { return Modifier.isPublic(method.getModifiers()) && method.getName().equals(name); } }) .toSet(); }
for (ValueType n : FluentIterable.from(nested).append(this)) { for (ValueAttribute a : n.attributes) { if (a.hasSomeUnresolvedTypes) {
/** * Returns an {@link Iterable} that includes the primary binding (the current one) and all * additional bindings. The primary binding is always the first item in the {@link Iterable}. */ public Iterable<HttpAttribute> getAllBindings() { return FluentIterable.from(ImmutableList.of(this)).append(additionalBindings); }
public Outputter( Logger logger, Processor processor, Filer filer, Collection<String> macroFiles) { this.logger = logger; this.processor = new Type(processor.getClass()); this.filer = filer; this.macroFiles = FluentIterable.from(macroFiles).append(DEFAULT_MACRO_FILE).toSet(); }
private static ImmutableSet<String> extractSeen(Set<String> seen, GResource resource) { return FluentIterable.from(resource.uriParameters()) .transform(new Function<GParameter, String>() { @Nullable @Override public String apply(@Nullable GParameter gParameter) { return gParameter.name(); } }).append(seen).toSet(); }
public static ClassLoader classLoaderFor(URL firstUrl, URL... theRest) { URL[] allOfDem = FluentIterable.of(theRest).append(firstUrl).toArray(URL.class); // In the absence of specific parent, we use the current one as the parent. // Otherwise, some incongruities might happen when running from the maven // plugin for example. return new URLClassLoader(allOfDem, Thread.currentThread().getContextClassLoader()); }
public static ClassLoader classLoaderFor(URL firstUrl, URL... theRest) { URL[] allOfDem = FluentIterable.of(theRest).append(firstUrl).toArray(URL.class); // In the absence of specific parent, we use the current one as the parent. // Otherwise, some incongruities might happen when running from the maven // plugin for example. return new URLClassLoader(allOfDem, Thread.currentThread().getContextClassLoader()); }
@Override public Collection<String> getImports() { FluentIterable<String> imports = from(typeArguments).transformAndConcat(EXTRACT_IMPORTS_FUNCTION); if (!array) { imports = imports.append(getQualifiedName()); } return imports.toSet(); }
@Override public Collection<String> getImports() { return FluentIterable.from(getFields()) .transformAndConcat(EXTRACT_IMPORTS_FUNCTION) .append(getType().getImports()) .toList(); } }
@Override public Collection<String> getImports() { return from(getEventType().getImports()) .append(getHandlerType().getImports()) .toList(); } }
@Override public Collection<String> getImports() { return FluentIterable.from(getMethod().getImports()) .append(getEndPoint().getType().getImports()) .toList(); } }
@Override public Collection<String> getImports() { return FluentIterable.from(getMethod().getImports()) .append(getSubResource().getType().getImports()) .toList(); } }