List of usage examples for com.google.common.collect Lists transform
@CheckReturnValue public static <F, T> List<T> transform(List<F> fromList, Function<? super F, ? extends T> function)
From source file:org.sosy_lab.cpachecker.util.predicates.interfaces.view.BaseManagerView.java
final List<Formula> unwrap(List<? extends Formula> f) { return Lists.transform(f, new Function<Formula, Formula>() { @Override//from w w w .j av a 2 s . c o m public Formula apply(Formula pInput) { return unwrap(pInput); } }); }
From source file:org.raml.jaxrs.generator.v10.V10GMethod.java
public V10GMethod(final V10TypeRegistry registry, final V10GResource v10GResource, final Method method) { this.v10GResource = v10GResource; this.method = method; this.requests = Lists.transform(this.method.body(), new Function<TypeDeclaration, GRequest>() { @Nullable/* ww w . java 2s . co m*/ @Override public GRequest apply(@Nullable TypeDeclaration input) { if (TypeUtils.shouldCreateNewClass(input, input.parentTypes().toArray(new TypeDeclaration[0]))) { return new V10GRequest(input, registry.fetchType(v10GResource.implementation(), method, input)); } else { return new V10GRequest(input, registry.fetchType(input.type(), input)); } } }); this.responses = Lists.transform(this.method.responses(), new Function<Response, GResponse>() { @Nullable @Override public GResponse apply(@Nullable Response input) { return new V10GResponse(registry, v10GResource, method, input); } }); this.queryParameters = Lists.transform(this.method.queryParameters(), new Function<TypeDeclaration, GParameter>() { @Nullable @Override public GParameter apply(@Nullable TypeDeclaration input) { return new V10PGParameter(registry, input); } }); }
From source file:ch.aonyx.broker.ib.api.account.ManagedAccountListEvent.java
public List<String> getAccounts() { return Collections.unmodifiableList( Lists.transform(Lists.newArrayList(StringUtils.split(commaSeparatedAccountList, separator)), toTrimmedStringFunction)); }
From source file:com.gantzgulch.sharing.form.UserForm.java
public UserForm(User user) { this.id = user.getId(); this.username = user.getUsername(); this.password = user.getPassword(); this.name = user.getName(); this.email = user.getEmail(); this.roles = Lists.transform(user.getUserRoles(), new UserRole.UserRoleToStringFunction()); }
From source file:com.seyren.api.bean.ChecksBean.java
@Override public Response getChecks(Set<String> states, Boolean enabled, String name, List<String> fields, List<String> regexes) { SeyrenResponse<Check> checks;//from w ww. ja va 2s. co m if (states != null && !states.isEmpty()) { checks = checksStore.getChecksByState(states, enabled); } else if (fields != null && !fields.isEmpty() && regexes != null && !regexes.isEmpty()) { List<Pattern> patterns = Lists.transform(regexes, new Function<String, Pattern>() { @Override public Pattern apply(String regex) { return Pattern.compile(regex); } }); checks = checksStore.getChecksByPattern(fields, patterns, enabled); } else { checks = checksStore.getChecks(enabled, null); } return Response.ok(checks).build(); }
From source file:org.opendaylight.bgpcep.pcep.topology.provider.OperationResults.java
public static OperationResults createFailed(final List<Errors> errors) { final List<Errors> e = errors != null ? errors : Collections.<Errors>emptyList(); return new OperationResults(FailureType.Failed, Lists.transform(e, CONVERT_ERRORS)); }
From source file:com.google.jstestdriver.MockServer.java
private String get(String request) { Queue<String> response = expectations.get(request); if (response == null || response.size() == 0) { System.out.println("Unexpected request: " + request + "\n in " + Lists.transform(Lists.newArrayList(expectations.keySet()), new Function<String, String>() { public String apply(String arg) { return "\n" + arg; }/*w w w . jav a 2s .c o m*/ })); throw new IllegalArgumentException("Unexpected request: " + request); } return response.remove(); }
From source file:org.zanata.util.WebElementUtil.java
public static List<String> elementsToText(WebDriver driver, final By by) { return waitForAMoment(driver).until(input -> { if (input == null) { throw new RuntimeException("Driver is null"); }// w w w . ja v a 2s . c o m List<WebElement> elements = input.findElements(by); return ImmutableList.copyOf(Lists.transform(elements, WebElementToTextFunction.FUNCTION)); }); }
From source file:com.dangdang.ddframe.rdb.sharding.config.common.internal.parser.InlineParser.java
/** * inline?./*w w w. ja va 2s .co m*/ * * @return ??? */ public List<String> evaluate() { final GroovyShell shell = new GroovyShell(); return flattenSegments(Lists.transform(splitWithInlineExpression(), new Function<String, Object>() { @Override public Object apply(final String input) { StringBuilder expression = new StringBuilder(input); if (!input.startsWith("\"")) { expression.insert(0, "\""); } if (!input.endsWith("\"")) { expression.append("\""); } return shell.evaluate(expression.toString()); } })); }
From source file:models.Nodelist.java
public static List<NodeContent> getLastNodes(Integer count) { List<NodeContent> r = null; try {/*from w w w . ja v a 2s . c o m*/ BasicDBObject query = new BasicDBObject().append(CREATED, new BasicDBObject("$gt", System.currentTimeMillis() - t24h)); DBCursor iobj = MongoDB.getDB().getCollection(MongoDB.CNode).find(query).sort(lastSort) .limit(count == null ? 30 : count); if (iobj != null) r = Lists.transform(iobj.toArray(), MongoDB.getSelf().toNodeContent()); } catch (Exception ex) { Logger.info("getLastNodes"); ex.printStackTrace(); Logger.info(ex.toString()); } return r; }