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:com.haoocai.jscheduler.core.task.ServerNode.java
List<SchedulerUnit> getTaskSchedulerUnits() { List<String> servers = zkAccessor.getChildren(taskID.identify() + ROOT); return Lists.newArrayList(Lists.transform(servers, new Function<String, SchedulerUnit>() { @Override//from www . j a va2 s .c om public SchedulerUnit apply(String input) { return new SchedulerUnit(input); } })); }
From source file:fm.last.musicbrainz.coverart.impl.ProxiedCoverArtImageBeanDecorator.java
@Override public Set<CoverArtType> getTypes() { List<String> types = delegate.getTypes(); return Sets.newHashSet(Lists.transform(types, CoverArtTypeStringToEnumValue.INSTANCE)); }
From source file:com.facebook.presto.util.MaterializedResult.java
public MaterializedResult(List<Tuple> tuples, TupleInfo tupleInfo, final int precision) { this.tuples = Lists.transform(checkNotNull(tuples, "tuples is null"), new Function<Tuple, MaterializedTuple>() { @Override/*from w ww .ja v a2s . c o m*/ public MaterializedTuple apply(Tuple input) { return new MaterializedTuple(input, precision); } }); this.tupleInfo = checkNotNull(tupleInfo, "tupleInfo is null"); }
From source file:com.facebook.presto.jdbc.client.ClientTypeSignature.java
public ClientTypeSignature(TypeSignature typeSignature) { this(typeSignature.getBase(), Lists.transform(typeSignature.getParameters(), new Function<TypeSignature, ClientTypeSignature>() { @Nullable/*w w w . j a v a 2 s.c om*/ @Override public ClientTypeSignature apply(TypeSignature typeSignature1) { return new ClientTypeSignature(typeSignature1); } }), typeSignature.getLiteralParameters()); }
From source file:com.googlesource.gerrit.plugins.uploadvalidator.DuplicatePathnameValidator.java
public static AbstractModule module() { return new AbstractModule() { private List<String> getAvailableLocales() { return Lists.transform(Arrays.asList(Locale.getAvailableLocales()), new Function<Locale, String>() { @Override//from ww w .j a va2s . c o m public String apply(Locale input) { return input.toString(); } }); } @Override protected void configure() { DynamicSet.bind(binder(), CommitValidationListener.class).to(DuplicatePathnameValidator.class); bind(ProjectConfigEntry.class).annotatedWith(Exports.named(KEY_REJECT_DUPLICATE_PATHNAMES)) .toInstance(new ProjectConfigEntry("Reject Duplicate Pathnames", null, ProjectConfigEntryType.BOOLEAN, null, false, "Pushes of commits that contain duplicate pathnames, or that " + "contain duplicates of existing pathnames will be " + "rejected. Pathnames y and z are considered to be " + "duplicates if they are equal, case-insensitive.")); bind(ProjectConfigEntry.class).annotatedWith(Exports.named(KEY_REJECT_DUPLICATE_PATHNAMES_LOCALE)) .toInstance(new ProjectConfigEntry("Reject Duplicate Pathnames Locale", "en", ProjectConfigEntryType.STRING, getAvailableLocales(), false, "To avoid problems caused by comparing pathnames with different " + "locales it is possible to use a specific locale. The " + "default is English (en).")); } }; }
From source file:com.netflix.metacat.common.type.RowType.java
/** * Constructor./*from ww w .ja v a 2 s . c om*/ * * @param fields The fields of this row */ public RowType(@Nonnull @NonNull final List<RowField> fields) { super(new TypeSignature(TypeEnum.ROW, Lists.transform(Lists.transform(fields, new Function<RowField, Type>() { public Type apply(@Nullable final RowField input) { return input == null ? null : input.getType(); } }), new Function<Type, TypeSignature>() { public TypeSignature apply(@Nullable final Type input) { return input == null ? null : input.getTypeSignature(); } }), Lists.transform(fields, new Function<RowField, Object>() { public Object apply(@Nullable final RowField input) { return input == null ? null : input.getName(); } }))); this.fields = ImmutableList.copyOf(fields); }
From source file:fi.luontola.buildtest.Deprecations.java
public void verify(Iterable<ClassNode> classes, Date now) { List<String> expected = Lists.transform(this.expected, Deprecation.GetIdentifier); List<String> actual = findDeprecations(classes); List<String> unexpected = new ArrayList<String>(); unexpected.addAll(actual);//from w w w . java 2s . com unexpected.removeAll(expected); assertEmpty(UNEXPECTED_DEPRECATIONS_MESSAGE, unexpected); List<String> missing = new ArrayList<String>(); missing.addAll(expected); missing.removeAll(actual); assertEmpty(MISSING_DEPRECATIONS_MESSAGE, missing); List<String> expired = new ArrayList<String>(); for (Deprecation deprecation : this.expected) { if (deprecation.isExpired(now)) { expired.add(deprecation.identifier); } } assertEmpty(EXPIRED_DEPRECATIONS_MESSAGE, expired); }
From source file:com.shigengyu.hyperion.server.controllers.HyperionRuntimeEnvironmentController.java
@GET @Path("/workflow/list/") public String getWorkflowDefinitions() { List<String> workflowDefinitionNames = Lists.transform( hyperionRuntime.getWorkflowDefinitionCache().getAll(), new Function<WorkflowDefinition, String>() { @Override/*w w w .j a va 2 s .c o m*/ public String apply(final WorkflowDefinition input) { return input.getName(); } }); if (workflowDefinitionNames.size() == 0) { return "No workflow definition found"; } return StringUtils.join(workflowDefinitionNames, "<br />"); }
From source file:org.jboss.pressgang.ccms.util.WebElementUtil.java
public static List<TableRow> getTableRows(WebDriver driver, final By byQueryForTable) { return waitForTenSeconds(driver).until(new Function<WebDriver, List<TableRow>>() { @Override//from w w w . java 2 s.c o m public List<TableRow> apply(WebDriver webDriver) { final WebElement table = webDriver.findElement(byQueryForTable); List<WebElement> rows = table.findElements(By.xpath(".//tbody[1]/tr")); return ImmutableList.copyOf(Lists.transform(rows, WebElementTableRowFunction.FUNCTION)); } }); }
From source file:ch.raffael.contracts.devtools.ast.AstTreeNode.java
public AstTreeNode(AstTreeNode parent, AstNode node) { this.parent = parent; this.node = node; if (node != null) { renderer = NodeRenderer.get(node); children = ImmutableList/*from w w w . j av a 2 s .com*/ .copyOf(Lists.transform(node.getChildren(), new Function<AstNode, AstTreeNode>() { @Override public AstTreeNode apply(AstNode input) { return new AstTreeNode(AstTreeNode.this, input); } })); } else { renderer = null; children = Collections.emptyList(); } }