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:kuona.jenkins.analyser.model.JobWithDetails.java
public List<Job> getUpstreamProjects() { return Lists.transform(upstreamProjects, new JobWithClient()); }
From source file:com.ronleisti.workdays.webservice.UnitsOfWorkWebService.java
@POST @Consumes(MediaType.APPLICATION_JSON)/*from www .jav a 2 s .co m*/ @Produces(MediaType.APPLICATION_JSON) public Response postUnitsOfWork(@PathParam("day") String day, Object data) { final Date dayValue = Date.valueOf(day); if (data instanceof List<?>) { @SuppressWarnings("unchecked") final List<Object> items = (List<Object>) data; final List<UnitOfWork> parsedItems = Lists.transform(items, new Function<Object, UnitOfWork>() { @SuppressWarnings("unchecked") @Override public UnitOfWork apply(final Object rawItem) { return UnitOfWork.fromMap(dayValue, (Map<String, Object>) rawItem); } }); service.updateDay(dayValue, parsedItems); } return getUnitsOfWork(day); }
From source file:com.dangdang.ddframe.rdb.sharding.parser.visitor.or.node.AbstractOrASTNode.java
/** * ????./* w w w .j a v a2 s . c om*/ * * @return ??? */ public final List<ConditionContext> getCondition() { return Lists.newArrayList(Iterators .filter(Lists.transform(nestedConditions, new Function<List<Condition>, ConditionContext>() { @Override public ConditionContext apply(final List<Condition> input) { ConditionContext result = new ConditionContext(); for (Condition each : input) { result.add(each); } return result; } }).iterator(), new Predicate<ConditionContext>() { @Override public boolean apply(final ConditionContext input) { return !input.isEmpty(); } })); }
From source file:org.sonarsource.sonarlint.core.analyzer.issue.DefaultClientIssue.java
public DefaultClientIssue(String severity, ActiveRule activeRule, Rule rule, String primaryMessage, @Nullable TextRange textRange, @Nullable ClientInputFile clientInputFile, List<org.sonar.api.batch.sensor.issue.Issue.Flow> flows) { super(textRange); this.severity = severity; this.activeRule = activeRule; this.rule = rule; this.primaryMessage = primaryMessage; this.clientInputFile = clientInputFile; this.flows = Lists.transform(flows, f -> new DefaultFlow(f.locations())); }
From source file:com.google.cloud.translate.TranslateImpl.java
@Override public List<Language> listSupportedLanguages(final LanguageListOption... options) { try {/* w w w . j ava2 s .co m*/ return Lists.transform(runWithRetries(new Callable<List<LanguagesResource>>() { @Override public List<LanguagesResource> call() { return translateRpc.listSupportedLanguages(optionMap(options)); } }, getOptions().getRetrySettings(), EXCEPTION_HANDLER, getOptions().getClock()), Language.FROM_PB_FUNCTION); } catch (RetryHelperException e) { throw TranslateException.translateAndThrow(e); } }
From source file:org.opendaylight.yangtools.sal.binding.yang.types.UnionDependencySort.java
/** * Sorts union types by mutual dependencies. * * At the beginning the union types are selected from * <code>typeDefinitions</code> and wrapped to nodes. The nodes are sorted * and then the wrapped payload is extracted. * * @param typeDefinitions// w w w.j a v a 2 s . co m * set of type definitions. * @return list of extended type which are sorted by mutual dependencies * @throws IllegalArgumentException * if <code>typeDefinitions</code> equals <code>null</code> */ public List<ExtendedType> sort(final Set<TypeDefinition<?>> typeDefinitions) { if (typeDefinitions == null) { LOGGER.error("Set of Type Definitions cannot be NULL!"); throw new IllegalArgumentException("Set of Type Definitions " + "cannot be NULL!"); } final Set<ExtendedType> extUnionTypes = unionsFromTypeDefinitions(typeDefinitions); final Set<Node> unsorted = unionTypesToNodes(extUnionTypes); final List<Node> sortedNodes = TopologicalSort.sort(unsorted); return Lists.transform(sortedNodes, new Function<Node, ExtendedType>() { @Override public ExtendedType apply(final Node input) { return (ExtendedType) (((NodeWrappedType) input).getWrappedType()); } }); }
From source file:com.google.gerrit.sshd.commands.BanCommitCommand.java
@Override protected void run() throws Failure { try {/*from w ww .j a va2 s . co m*/ BanCommit.Input input = BanCommit.Input.fromCommits(Lists.transform(commitsToBan, ObjectId::getName)); input.reason = reason; BanResultInfo r = banCommit.apply(new ProjectResource(projectControl), input); printCommits(r.newlyBanned, "The following commits were banned"); printCommits(r.alreadyBanned, "The following commits were already banned"); printCommits(r.ignored, "The following ids do not represent commits and were ignored"); } catch (RestApiException | IOException e) { throw die(e); } }
From source file:org.sosy_lab.cpachecker.cfa.model.MultiEdge.java
@Override public final String getRawStatement() { return Joiner.on('\n').join(Lists.transform(edges, new Function<CFAEdge, String>() { @Override//w ww . j av a 2s . c o m public String apply(CFAEdge pInput) { return pInput.getRawStatement(); } })); }
From source file:org.eclipse.xtext.xbase.ui.contentassist.ParameterData.java
public List<String> getRawDisplayString() { sort();/*from w w w . j a v a 2s . c o m*/ return Lists.transform(variants, new Function<Pair<String, Boolean>, String>() { @Override public String apply(Pair<String, Boolean> input) { return input.getFirst(); } }); }
From source file:org.apache.sling.testing.mock.jcr.MockQueryResult.java
@Override public RowIterator getRows() throws RepositoryException { return new RowIteratorAdapter(Lists.transform(nodes, new Function<Node, Row>() { @Override//w ww . j ava2 s . co m public Row apply(Node node) { return new MockRow(columnNames, node); } })); }