@Override public boolean consume(Options option, String nextArg) { if (nextArg == null) { quitEarly("-condition option must be followed by a comma separated list of conditions"); } option.simpleBooleanConditions = FluentIterable.from(Splitter.on(',').split(nextArg)) .toSet(); return true; } });
FluentIterable.from(Splitter.on(',').split(options.scope)).toSet(); HashSet<URL> set = new HashSet<URL>(); for (String scopeFile : scopeFileSet) {
@Override public boolean consume(Options option, String nextArg) { if (nextArg == null) { quitEarly("-condition option must be followed by a comma separated list of conditions"); } option.simpleBooleanConditions = FluentIterable.from(Splitter.on(',').split(nextArg)) .toSet(); return true; } });
FluentIterable.from(Splitter.on(',').split(options.scope)).toSet(); HashSet<URL> set = new HashSet<URL>(); for (String scopeFile : scopeFileSet) {
private static Optional<JNewInstance> newInstance(final TreeLogger logger, final SourceInfo sourceInfo, final UnifyAstView ast, final JDeclaredType answerType) { final Optional<JMethod> ctor = FluentIterable.from(answerType.getMethods()).firstMatch((m)->m.isConstructor() && m.getParams().size() == 0); if (ctor.isPresent()) { final JNewInstance result = new JNewInstance(sourceInfo, (JConstructor)ctor.get()); return Optional.of(result); } else { return Optional.absent(); } }
@Test public void asListThatDependsOnAnother() { p.set(list("a", "b")); StringProperty s = stringProperty("s", "c"); ListProperty<String> q = p.asList(l -> FluentIterable.from(l).append(s.get()).toList()); assertThat(p.get(), contains("a", "b")); assertThat(q.get(), contains("a", "b", "c")); CountingChanges<List<String>> c = new CountingChanges<List<String>>(); q.addPropertyChangedHandler(c); p.add("b"); assertThat(c.count, is(1)); assertThat(q.get(), contains("a", "b", "b", "c")); s.set("d"); assertThat(c.count, is(2)); assertThat(q.get(), contains("a", "b", "b", "d")); }