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.android.build.gradle.internal.DefaultAndroidNativeDependencySpecContainer.java
@Override public Collection<AndroidNativeDependencySpec> getDependencies() { if (builders.isEmpty()) { return Collections.emptySet(); }/*from w ww .j a va 2 s . co m*/ return ImmutableSet.copyOf(Lists.transform(builders, AndroidNativeDependencySpec.Builder::build)); }
From source file:com.google.javascript.jscomp.ES6ModuleLoader.java
/** * Creates an instance of the module loader which can be used to locate ES6 and CommonJS modules. * * @param moduleRoots The root directories to locate modules in. * @param inputs All inputs to the compilation process. */// w ww . j a v a 2 s .c o m public ES6ModuleLoader(List<String> moduleRoots, Iterable<CompilerInput> inputs) { this.moduleRootUris = Lists.transform(moduleRoots, new Function<String, URI>() { @Override public URI apply(String path) { return createUri(path); } }); this.moduleUris = new HashSet<URI>(); for (CompilerInput input : inputs) { if (!moduleUris.add(normalizeInputAddress(input))) { // Having root URIs "a" and "b" and source files "a/f.js" and "b/f.js" is ambiguous. throw new IllegalArgumentException("Duplicate module URI after resolving: " + input.getName()); } } }
From source file:org.adsync4j.testutils.ldap.EmbeddedLdapServerFactoryBean.java
private static List<InputStream> resourceArrayToInputStreamList(Resource[] resources) { return Lists.transform(Arrays.asList(resources), new Function<Resource, InputStream>() { @Override// www . j av a 2 s. c o m public InputStream apply(@Nullable Resource resource) { return resourceToInputStream(resource); } }); }
From source file:com.feedzai.commons.sql.abstraction.engine.impl.OracleTranslator.java
@Override public String translate(AlterColumn ac) { final DbColumn column = ac.getColumn(); final Expression table = ac.getTable(); final Name name = new Name(column.getName()); inject(table, name);// w w w .ja v a 2s . c o m StringBuilder sb = new StringBuilder("ALTER TABLE ").append(table.translate()).append(" MODIFY (") .append(name.translate()).append(" ").append(translate(column)).append(" "); List<Object> trans = Lists.transform(column.getColumnConstraints(), new com.google.common.base.Function<DbColumnConstraint, Object>() { @Override public Object apply(DbColumnConstraint input) { return input.translate(); } }); sb.append(Joiner.on(" ").join(trans)); sb.append(")"); return sb.toString(); }
From source file:sklearn.Classifier.java
static private List<String> formatTargetCategories(List<?> objects) { Function<Object, String> function = new Function<Object, String>() { @Override/*from www .jav a 2 s . c o m*/ public String apply(Object object) { String targetCategory = ValueUtil.formatValue(object); if (targetCategory == null || CharMatcher.WHITESPACE.matchesAnyOf(targetCategory)) { throw new IllegalArgumentException(targetCategory); } return targetCategory; } }; return new ArrayList<>(Lists.transform(objects, function)); }
From source file:edu.buaa.satla.analysis.core.arg.MutableARGPath.java
public List<CFAEdge> asEdgesList() { return Lists.transform(this, Pair.<CFAEdge>getProjectionToSecond()); }
From source file:dmh.kuebiko.controller.NoteManager.java
/** * @return A view containing the titles for all notes in the stack. *//* www. j av a 2 s . c om*/ public List<String> getNoteTitles() { return Lists.transform(notes, NoteTitleFunction.getInstance()); }
From source file:com.onboard.domain.transform.CommentTransform.java
public static Comment commentDTOtoComment(CommentDTO commentDTO) { Comment comment = new Comment(); BeanUtils.copyProperties(commentDTO, comment); if (commentDTO.getSubscriberDTOs() != null) { comment.setSubscribers(//from w w w. j a va 2 s . co m Lists.transform(commentDTO.getSubscriberDTOs(), UserTransform.USERDTO_TO_USER_FUNCTION)); } if (commentDTO.getAttachmentDTOs() != null) { comment.setAttachments(Lists.transform(commentDTO.getAttachmentDTOs(), AttachmentTransform.ATTACHMENTDTO_TO_ATTACHMENT_FUNCTION)); } if (commentDTO.getDiscardAttachmentDTOs() != null) { comment.setAttachments(Lists.transform(commentDTO.getDiscardAttachmentDTOs(), AttachmentTransform.ATTACHMENTDTO_TO_ATTACHMENT_FUNCTION)); } return comment; }
From source file:org.sosy_lab.cpachecker.util.predicates.interpolation.strategy.SequentialInterpolation.java
@Override public List<BooleanFormula> getInterpolants(final InterpolationManager.Interpolator<T> interpolator, final List<Triple<BooleanFormula, AbstractState, T>> formulasWithStateAndGroupId) throws InterruptedException, SolverException { final List<T> formulas = Lists.transform(formulasWithStateAndGroupId, Triple.<T>getProjectionToThird()); final List<BooleanFormula> interpolants = Lists.newArrayListWithExpectedSize(formulas.size() - 1); for (int end_of_A = 0; end_of_A < formulas.size() - 1; end_of_A++) { // last iteration is left out because B would be empty final int start_of_A = 0; interpolants.add(getInterpolantFromSublist(interpolator.itpProver, formulas, start_of_A, end_of_A)); }//from w ww . j a v a 2 s . co m return interpolants; }
From source file:fm.last.lastfmlive.data.Chart.java
public List<T> sortedView() { Ordering<Map.Entry<T, Integer>> ordering = new Ordering<Map.Entry<T, Integer>>() { @Override/*w ww . j a va 2 s.c om*/ public int compare(java.util.Map.Entry<T, Integer> arg0, java.util.Map.Entry<T, Integer> arg1) { return arg0.getValue().compareTo(arg1.getValue()); } }; return Lists.transform(ordering.reverse().sortedCopy(artistCountMap.entrySet()), new Function<Map.Entry<T, Integer>, T>() { public T apply(Entry<T, Integer> arg0) { return arg0.getKey(); } }); }