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.shigengyu.hyperion.core.WorkflowStateSet.java
@SafeVarargs public static WorkflowStateSet from(Class<? extends WorkflowState>... workflowStates) { if (workflowStates == null || workflowStates.length == 0) { return WorkflowStateSet.empty(); }//from www .j av a2 s . c om return new WorkflowStateSet(Lists.transform(Lists.newArrayList(workflowStates), new Function<Class<? extends WorkflowState>, WorkflowState>() { @Override public WorkflowState apply(Class<? extends WorkflowState> input) { return WorkflowState.of(input); } })); }
From source file:org.jpmml.converter.ModelUtil.java
static public MiningSchema createMiningSchema(FieldName targetField, List<FieldName> activeFields) { List<MiningField> miningFields = new ArrayList<>(); if (targetField != null) { miningFields.add(createMiningField(targetField, MiningField.UsageType.TARGET)); }/*from w ww . ja va2 s. c o m*/ Function<FieldName, MiningField> function = new Function<FieldName, MiningField>() { @Override public MiningField apply(FieldName name) { return createMiningField(name); } }; miningFields.addAll(Lists.transform(activeFields, function)); MiningSchema miningSchema = new MiningSchema(miningFields); return miningSchema; }
From source file:org.apache.bookkeeper.server.component.ServerLifecycleComponent.java
public static List<ServerLifecycleComponent> loadServerComponents(String[] componentClassNames, BookieConfiguration conf, StatsLogger statsLogger) { List<Class<? extends ServerLifecycleComponent>> componentClasses = Lists .newArrayListWithExpectedSize(componentClassNames.length); for (String componentClsName : componentClassNames) { componentClasses.add(ReflectionUtils.forName(componentClsName, ServerLifecycleComponent.class)); }/*from w ww. j a va2 s . com*/ return Lists.transform(componentClasses, cls -> newComponent(cls, conf, statsLogger)); }
From source file:ch.puzzle.itc.mobiliar.test.EntityBuilderType.java
public static List<String> typeNames() { return Lists.transform(vals(), new Function<EntityBuilderType, String>() { public String apply(EntityBuilderType input) { return input.type; }//ww w.j a v a 2s. c om }); }
From source file:com.cloudera.oryx.kmeans.common.Weighted.java
/** * Converts an input {@code List<T>} into a {@code List<Weighted>}. * /* w w w .j ava 2 s. co m*/ * @param things The items to convert * @return The items as {@code Weighted<T>} values with weight 1.0 */ public static <T> List<Weighted<T>> create(List<T> things) { return Lists.transform(things, new WeightFunction<T>()); }
From source file:sklearn.tree.TreeModelUtil.java
static public <E extends Estimator & HasTree> List<TreeModel> encodeTreeModelSegmentation(List<E> estimators, final MiningFunction miningFunction, final Schema schema) { Function<E, TreeModel> function = new Function<E, TreeModel>() { private Schema segmentSchema = schema.toAnonymousSchema(); @Override/*from w w w . j a v a2 s.c o m*/ public TreeModel apply(E estimator) { return TreeModelUtil.encodeTreeModel(estimator, miningFunction, this.segmentSchema); } }; return new ArrayList<>(Lists.transform(estimators, function)); }
From source file:eu.itesla_project.computation.AbstractCommand.java
@Override public List<InputFile> getInputFiles(final String executionNumber) { return Lists.transform(inputFiles, new Function<InputFile, InputFile>() { @Override/*from ww w . j a va 2 s .c o m*/ public InputFile apply(InputFile file) { return file.instanciate(executionNumber); } }); }
From source file:sklearn.EstimatorUtil.java
static public List<? extends Classifier> asClassifierList(List<?> objects) { return Lists.transform(objects, EstimatorUtil.classifierTransformer); }
From source file:org.scassandra.http.client.CurrentConnectionReport.java
@Override public List<InetSocketAddress> getAddresses() { return Lists.transform(this.connections, new Function<ClientConnection, InetSocketAddress>() { @Override//from w ww . ja v a 2s .co m public InetSocketAddress apply(ClientConnection input) { return input.getAddress(); } }); }
From source file:org.gradle.model.internal.core.DependencyOnlyExtractedModelRule.java
public List<Class<?>> getRuleDependencies() { return Lists.transform(dependencies, new Function<ModelType<?>, Class<?>>() { @Override/*w ww . j av a 2s. c o m*/ public Class<?> apply(ModelType<?> type) { return type.getRawClass(); } }); }