/** * Same as {@link #empty()}. */ default <T> MutableSet<T> of() { return this.empty(); }
@Override public MutableSet<V> toSet() { return Sets.mutable.with(this.value1); }
/** * Same as {@link #withAll(Iterable)}. */ default <T> MutableSet<T> ofAll(Iterable<? extends T> items) { return this.withAll(items); }
private void generate(String schema) { MutableSet<MyInput> inputs = Sets.mutable.empty(); inputs.withAll(getUserTypes(numTypes)); inputs.withAll(getTables()); inputs.withAll(getViews()); inputs.withAll(getSps()); MutableSet<String> types = Sets.mutable.of("table", "view", "sp", "usertype"); File outputDir = new File("./target/testoutput"); FileUtils.deleteQuietly(outputDir); outputDir.mkdirs(); for (MyInput input : inputs) { MutableMap<String, Object> params = Maps.mutable.<String, Object>empty().withKeyValue( "name", input.getName() ); for (String type : types) { params.put("dependent" + type + "s", input.getDependenciesByType().get(type)); } File outputFile = new File(outputDir, schema + "/" + input.getType() + "/" + input.getName() + ".sql"); outputFile.getParentFile().mkdirs(); TestTemplateUtil.getInstance().writeTemplate("schemagen/" + input.getType() + ".sql.ftl", params, outputFile); } }
expectedColumns = Sets.mutable.with("A", "E"); if (testBatchUpdate) { executorJdbc.batchUpdate(conn, "insert into a (a) values (5)", batchArgs); expectedColumns = Sets.mutable.with("A"); if (testBatchUpdate) { executorJdbc.batchUpdate(conn, "alter table a drop column e", batchArgs); List<String> columnsInTableA = db2JdbcTemplate.query(conn, columnListSql, new ColumnListHandler<String>()); assertEquals(expectedColumns, Sets.mutable.withAll(columnsInTableA));
@Test public void testSlash() { Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles( " 123 attr=\"abc\\def\" \\ 456=789" ); if (legacyMode) { assertEquals(Maps.mutable.of("attr", "abc\\def", "456", "789"), results.getOne()); assertEquals(Sets.mutable.of("123", "\\"), results.getTwo()); } else { assertEquals(Maps.mutable.of("attr", "abc\\def", "456", "789"), results.getOne()); assertEquals(Sets.mutable.of("123", "\\"), results.getTwo()); } }
/** * Same as {@link #empty()}. but takes in initial capacity. */ default <T> MutableSet<T> ofInitialCapacity(int capacity) { return this.withInitialCapacity(capacity); }
/** * @since 10.0. */ default <T> ImmutableSet<T> fromStream(Stream<? extends T> stream) { return Sets.mutable.<T>fromStream(stream).toImmutable(); } }
expectedColumns = Sets.mutable.with("A", "E"); if (testBatchUpdate) { executorJdbc.batchUpdate(conn, "insert into a (a) values (5)", batchArgs); expectedColumns = Sets.mutable.with("A"); if (testBatchUpdate) { executorJdbc.batchUpdate(conn, "alter table a drop column e", batchArgs); List<String> columnsInTableA = db2JdbcTemplate.query(conn, columnListSql, new ColumnListHandler<String>()); assertEquals(expectedColumns, Sets.mutable.withAll(columnsInTableA));
@Test public void testBehaviorOfStringStartingWithEqualSign() { Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles( " e q =attr 1234 attr2=\"5678\"\" \"\"mytog1\" " ); if (legacyMode) { assertEquals(Maps.mutable.of("", "attr", "attr2", "5678\""), results.getOne()); assertEquals(Sets.mutable.of("1234", "\"\"mytog1\"", "e", "q"), results.getTwo()); } else { assertEquals(Maps.mutable.of("attr2", "5678\""), results.getOne()); assertEquals(Sets.mutable.of("=", "attr", "1234", "\"\"mytog1\"", "e", "q"), results.getTwo()); } }
/** * Same as {@link #empty()}. but takes in initial capacity. */ default <T> MutableSet<T> ofInitialCapacity(int capacity) { return this.withInitialCapacity(capacity); }
/** * @since 10.0. */ default <T> ImmutableSet<T> fromStream(Stream<? extends T> stream) { return Sets.mutable.<T>fromStream(stream).toImmutable(); } }
@Override public MutableSet<T> value() { return Sets.mutable.empty(); } }
@Override public MutableSet<V> toSet() { return Sets.mutable.with(); }
@Test public void testQuoteWithinStringIsStillPreservedEvenIfStringIsntClosedForBackwardsCompatibility() { Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles( " =attr 1234 attr2=\"56\"78 mytog1 " ); if (legacyMode) { assertEquals(Maps.mutable.of("", "attr", "attr2", "\"56\"78"), results.getOne()); assertEquals(Sets.mutable.of("1234", "mytog1"), results.getTwo()); } else { assertEquals(Maps.mutable.of("attr2", "\"56\"78"), results.getOne()); assertEquals(Sets.mutable.of("=", "attr", "1234", "mytog1"), results.getTwo()); } }
/** * Same as {@link #withAll(Iterable)}. */ default <T> MutableSet<T> ofAll(Iterable<? extends T> items) { return this.withAll(items); }
/** * Same as {@link #empty()}. */ default <T> MutableSet<T> of() { return this.empty(); }
@Override public MutableSet<V> toSet() { return Sets.mutable.with(); }
@Test public void testSlashWithQuoteNoEscaping2() { Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles( " 123 attr=\"abc\\d ef\" \\ 456=789" ); if (legacyMode) { assertEquals(Maps.mutable.of("attr", "\"abc\\d", "456", "789"), results.getOne()); assertEquals(Sets.mutable.of("123", "\\", "ef\""), results.getTwo()); } else { assertEquals(Maps.mutable.of("attr", "abc\\d ef", "456", "789"), results.getOne()); assertEquals(Sets.mutable.of("123", "\\"), results.getTwo()); } }
/** * Same as {@link #empty()}. */ default <T> MutableSet<T> with() { return this.empty(); }