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.cloudera.oryx.computation.common.records.RecordSpec.java
@Override public List<String> getFieldNames() { return Lists.transform(fields, new Function<FieldSpec, String>() { @Override// www .j a v a2s . c om public String apply(FieldSpec input) { return input.name(); } }); }
From source file:com.cloudera.oryx.kmeans.computation.normalize.NormalizeSettings.java
private static void load(Config normalize, String path, Transform transform, Function<Object, Integer> lookup, Map<Integer, Transform> output) { if (normalize.hasPath(path)) { for (Integer column : Lists.transform(normalize.getAnyRefList(path), lookup)) { if (output.containsKey(column)) { throw new IllegalStateException("Multiple transforms specified for column: " + column); }//from ww w.ja va 2 s.co m output.put(column, transform); } } }
From source file:com.b2international.snowowl.datastore.server.ServerProtocolFactoryRegistry.java
public List<ServerProtocolFactory> getRegisteredServerProtocolFactories() { IConfigurationElement[] configurationElements = Platform.getExtensionRegistry() .getConfigurationElementsFor(EXTENSION_POINT_ID); return Lists.transform(Arrays.asList(configurationElements), new Function<IConfigurationElement, ServerProtocolFactory>() { @Override/* w w w.jav a 2 s.co m*/ public ServerProtocolFactory apply(IConfigurationElement input) { try { return (ServerProtocolFactory) input.createExecutableExtension(CLASS_ATTRIBUTE); } catch (final CoreException e) { throw new RuntimeException( "Error while creating executable extension from the passed in configuration element: " + input, e); } } }); }
From source file:org.jasig.portlet.notice.service.jpa.NotificationDTOMapper.java
@Override public List<EntryDTO> toEntryList(List<JpaEntry> entries) { return Lists.transform(entries, new Function<JpaEntry, EntryDTO>() { @Override/* w w w.jav a 2s.c o m*/ public EntryDTO apply(JpaEntry jpaEntry) { return toEntry(jpaEntry); } }); }
From source file:org.sosy_lab.solver.basicimpl.AbstractQuantifiedFormulaManager.java
@Override public BooleanFormula exists(List<? extends Formula> pVariables, BooleanFormula pBody) { return wrap(exists(Lists.transform(pVariables, extractor), extractInfo(pBody))); }
From source file:com.facebook.presto.util.Failures.java
public static ExecutionFailureInfo toFailure(Throwable failure) { if (failure == null) { return null; }/*from ww w.ja v a2s . c om*/ // todo prevent looping with suppressed cause loops and such String type; if (failure instanceof Failure) { type = ((Failure) failure).getType(); } else { type = failure.getClass().getCanonicalName(); } return new ExecutionFailureInfo(type, failure.getMessage(), toFailure(failure.getCause()), toFailures(asList(failure.getSuppressed())), Lists.transform(asList(failure.getStackTrace()), toStringFunction()), getErrorLocation(failure), toErrorCode(failure)); }
From source file:org.gradle.model.internal.registry.DefaultInputs.java
public List<ModelReference<?>> getReferences() { return Lists.transform(inputs, new Function<ModelRuleInput<?>, ModelReference<?>>() { public ModelReference<?> apply(ModelRuleInput<?> input) { return input.getBinding().getReference(); }/*from www .jav a 2s . c om*/ }); }
From source file:org.isisaddons.app.kitchensink.dom.mixins.mixin.Person_removePreference.java
public List<FoodStuff> choices0$$() { final List<Preference> preferences = preferencesService.preferencesOf(person); return Lists.transform(preferences, Preference.Functions.food()); }
From source file:org.jclouds.openstack.marconi.v1.functions.ParseMessagesCreated.java
public MessagesCreated apply(HttpResponse from) { MessagesCreated rawMessagesCreated = json.apply(from); List<String> messageIds = Lists.transform(rawMessagesCreated.getMessageIds(), TO_ID_FROM_HREF); MessagesCreated messagesCreated = MessagesCreated.builder().messageIds(messageIds).build(); return messagesCreated; }
From source file:com.b2international.commons.Version.java
/** * Parses the specified {@link String} into a {@link Version} object. * The version string must be non-null and conform to the <code>\d+(\.\d+)+</code> format. * /*w w w.j a va2s. co m*/ * @param versionString the version string to parse * @return the parsed {@link Version} */ public static Version parseVersion(String versionString) { checkNotNull(versionString, "Version string must not be null."); checkArgument(VERSION_PATTERN.matcher(versionString).matches(), "Version string format is invalid: " + versionString); List<Integer> versionParts = Lists.transform( ImmutableList.copyOf(Splitter.on(VERSION_PART_SEPARATOR).split(versionString)), new StringToIntegerParserFunction()); return new Version(versionParts); }