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.onboard.domain.transform.BugTransForm.java
public static Bug bugDTOToBug(BugDTO bugDTO) { Bug bug = new Bug(); BeanUtils.copyProperties(bugDTO, bug); if (bugDTO.getSubscribers() != null) { bug.setSubscribers(Lists.transform(bugDTO.getSubscribers(), UserTransform.USERDTO_TO_USER_FUNCTION)); }/*from w w w . j ava 2s .c om*/ if (bugDTO.getBugAssigneeDTO() != null) { bug.setAssignee(UserTransform.userDTOToUser(bugDTO.getBugAssigneeDTO())); } return bug; }
From source file:ignitr.couchbase.discovery.ConfigDiscoveryStrategy.java
@Override public List<String> discoverClusterNodes() { String propertyValue = DynamicPropertyFactory.getInstance().getStringProperty(PROP_CONFIG_NODES, null) .get();/*from w ww . ja va2 s . com*/ if (StringUtils.isNotEmpty(propertyValue)) { return Lists.transform(Arrays.asList(propertyValue.split(",")), new Function<String, String>() { @Nullable @Override public String apply(String input) { return input.trim(); } }); } else { throw new IgnitrCouchbaseException(String.format( "Discovery strategy 'config' specified, but no nodes were " + "configured in '%s' property!", PROP_CONFIG_NODES)); } }
From source file:org.apache.storm.dependency.DependencyPropertiesParser.java
public List<File> parseJarsProperties(String prop) { if (prop.trim().isEmpty()) { // handle no input return Collections.emptyList(); }//from ww w . j a v a2 s.com List<String> dependencies = Arrays.asList(prop.split(",")); return Lists.transform(dependencies, new Function<String, File>() { @Override public File apply(String filePath) { return new File(filePath); } }); }
From source file:org.semanticweb.elk.proofs.TracingInferenceWrap.java
@Override public List<? extends Object> getPremises() { return Lists.transform(getDelegate().getPremises(), Functions.identity()); }
From source file:com.metamx.metrics.CompoundMonitor.java
@Override public boolean monitor(final ServiceEmitter emitter) { return shouldReschedule(Lists.transform(monitors, new Function<Monitor, Boolean>() { @Override//from w ww .j a v a 2s . c o m public Boolean apply(Monitor monitor) { return monitor.monitor(emitter); } })); }
From source file:com.github.tomakehurst.wiremock.matching.MultiValuePattern.java
private static MatchResult getBestMatch(final StringValuePattern valuePattern, List<String> values) { List<MatchResult> allResults = Lists.transform(values, new Function<String, MatchResult>() { public MatchResult apply(String input) { return valuePattern.match(input); }/*from www .j a v a2 s . co m*/ }); return min(allResults, new Comparator<MatchResult>() { public int compare(MatchResult o1, MatchResult o2) { return new Double(o1.getDistance()).compareTo(o2.getDistance()); } }); }
From source file:com.datastax.driver.core.ResultSetAssert.java
public ResultSetAssert(ResultSet actual) { super(actual.all(), ResultSetAssert.class); helper = new TupleListAssert(Lists.transform(this.actual, ROW_TO_TUPLE)); }
From source file:hu.bme.mit.massif.common.tracer.AbstractMassifTracer.java
protected List<Object> transformNameList(Object... formatObjects) { List<Object> namelist = Lists.transform(Lists.newArrayList(formatObjects), new Function<Object, Object>() { @Override/*w w w .j a va2 s . c o m*/ public Object apply(Object input) { if (input instanceof EObject) { return NamingUtil.getGlobalNameOfNamedElement((EObject) input); } return input; } }); return namelist; }
From source file:io.druid.query.UnionQueryRunner.java
@Override public Sequence<T> run(final Query<T> query, final Map<String, Object> responseContext) { DataSource dataSource = query.getDataSource(); if (dataSource instanceof UnionDataSource) { return toolChest.mergeSequencesUnordered(Sequences.simple(Lists.transform( ((UnionDataSource) dataSource).getDataSources(), new Function<DataSource, Sequence<T>>() { @Override/*from w w w .j av a 2 s .c o m*/ public Sequence<T> apply(DataSource singleSource) { return baseRunner.run(query.withDataSource(singleSource), responseContext); } }))); } else { return baseRunner.run(query, responseContext); } }
From source file:sklearn.EstimatorUtil.java
static public List<? extends Regressor> asRegressorList(List<?> objects) { return Lists.transform(objects, EstimatorUtil.regressorTransformer); }