public void testOf() { assertEquals(ImmutableList.of(1, 2, 3, 4), Lists.newArrayList(FluentIterable.of(1, 2, 3, 4))); }
public void testOf_empty() { assertEquals(ImmutableList.of(), Lists.newArrayList(FluentIterable.of())); }
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 testSize0() { assertEquals(0, FluentIterable.<String>of().size()); }
public void testOfToString() { assertEquals("[yam, bam, jam, ham]", FluentIterable.of("yam", "bam", "jam", "ham").toString()); }
public void testCycle_emptyIterable() { FluentIterable<Integer> cycle = FluentIterable.<Integer>of().cycle(); assertFalse(cycle.iterator().hasNext()); }
public void testToString() { assertEquals("[]", FluentIterable.from(Collections.emptyList()).toString()); assertEquals("[]", FluentIterable.<String>of().toString()); assertEquals( "[yam, bam, jam, ham]", FluentIterable.from(asList("yam", "bam", "jam", "ham")).toString()); }
FluentIterable.of( Introspector.getBeanInfo(ModifiableBeanFriendly.class) .getPropertyDescriptors());
@Override public Iterable<SourceTableDefinition> getDatasets(String user, DatasetRetrievalOptions ignored) throws Exception { return FluentIterable.of(InfoSchemaTable.values()).transform(new Function<InfoSchemaTable, SourceTableDefinition>(){ @Override public SourceTableDefinition apply(InfoSchemaTable input) { return input.asTableDefinition(null); }}); }
protected static Iterable<NullReference> nulls(FunctionRender... renders){ return FluentIterable.of(renders).transformAndConcat(new Function<FunctionRender, Iterable<NullReference>>(){ @Override public Iterable<NullReference> apply(FunctionRender input) { return input.getNulls(); }}); }
@Override public Iterable<SourceTableDefinition> getDatasets(String user, DatasetRetrievalOptions ignored) throws Exception { return FluentIterable.of(SystemTable.values()).transform(new Function<SystemTable, SourceTableDefinition>(){ @Override public SourceTableDefinition apply(SystemTable input) { return input.asTableDefinition(null); }}); }
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 Outputter( Logger logger, Processor processor, Filer filer, String... macroFiles) { this.logger = logger; this.processor = new Type(processor.getClass()); this.filer = filer; this.macroFiles = FluentIterable.of(macroFiles).append(DEFAULT_MACRO_FILE).toSet(); }
private void extractGatekeeperParams() { GatekeeperParams annotation = element.getAnnotation(GatekeeperParams.class); gatekeeperParams = new ArrayList<>(); if (annotation != null && verifyIsGatekeeperWithParams()) { FluentIterable.of(annotation.value()) .transform(param -> param .replace("\\", "\\\\") .replace("\"", "\\\"")) .copyInto(gatekeeperParams); } }
public T get(T def, Api api, GAbstraction... others) { if (api == null) { return def; } return getValueWithDefault(def, api, FluentIterable.of(others).transform(new Function<GAbstraction, Annotable>() { @Nullable @Override public Annotable apply(@Nullable GAbstraction o) { return (Annotable) o.implementation(); } }).toArray(Annotable.class)); }
private static String[] s(byte[]... values){ return FluentIterable.of(values).transform(new Function<byte[], String>(){ @Override public String apply(byte[] input) { if(input == null){ return null; } return new String(input, Charsets.UTF_8); }}).toArray(String.class); }
@Override public Iterable<SourceTableDefinition> getDatasets(String user, DatasetRetrievalOptions ignored) throws Exception { try (Admin admin = connection.getConnection().getAdmin()) { return FluentIterable.of(admin.listTableNames()).transform(new Function<TableName, SourceTableDefinition>(){ @Override public SourceTableDefinition apply(TableName input) { final NamespaceKey key = new NamespaceKey(ImmutableList.<String>of(name, input.getNamespaceAsString(), input.getQualifierAsString())); return new HBaseTableBuilder(key, null, connection, storeConfig.isSizeCalcEnabled, context); }}); } }
static void populate(VarCharVector vector, String[] values){ populate(vector, FluentIterable.of(values).transform(new Function<String, byte[]>(){ @Override public byte[] apply(String input) { if(input == null){ return null; } return input.getBytes(Charsets.UTF_8); }}).toArray(byte[].class)); }