List of usage examples for com.google.common.collect Collections2 transform
public static <F, T> Collection<T> transform(Collection<F> fromCollection, Function<? super F, T> function)
From source file:org.caleydo.core.id.IdentityIDTypeMapper.java
@Override public Collection<Set<V>> applySeq(Collection<K> sourceIDs) { return Collections2.transform(sourceIDs, this); }
From source file:org.elasticsearch.http.netty.NettyHttpClient.java
public static Collection<String> returnHttpResponseBodies(Collection<HttpResponse> responses) { return Collections2.transform(responses, FUNCTION_RESPONSE_TO_CONTENT); }
From source file:cd.go.contrib.elasticagents.docker.utils.Util.java
public static Collection<String> splitIntoLinesAndTrimSpaces(String lines) { if (isBlank(lines)) { return Collections.emptyList(); }/*from w w w . j a v a2 s .c o m*/ return Collections2.transform(Arrays.asList(lines.split("[\r\n]+")), new Function<String, String>() { @Override public String apply(String input) { return input.trim(); } }); }
From source file:com.ace.erp.service.sys.impl.UserAuthServiceImpl.java
public Set<String> findStringRoles(User user) { List<Role> roles = findRoles(user); if (roles == null || roles.size() <= 0) { return null; }//from w w w. j av a 2 s .co m logger.info("roles : " + roles.size()); return Sets.newHashSet(Collections2.transform(roles, new Function<Role, String>() { @Override public String apply(Role input) { logger.debug(input.toString()); return input.getRole(); } })); }
From source file:org.mandarax.dsl.verification.CheckFreeVariablesInExternalFacts.java
@Override public void verify(Collection<CompilationUnit> cus, VerificationErrorReporter errorHandler) throws VerificationException { for (CompilationUnit cu : cus) { // collect declared objects Collection<String> objNames = Collections2.transform(cu.getObjectDeclarations(), new Function<ObjectDeclaration, String>() { @Override//www .ja v a 2s. c o m public String apply(ObjectDeclaration obj) { return obj.getName(); } }); for (RelationshipDefinition rel : cu.getRelationshipDefinitions()) { for (RelationshipDefinitionPart part : rel.getDefinitionParts()) { if (part instanceof ExternalFacts) { ExternalFacts facts = (ExternalFacts) part; for (Variable var : facts.getIterable().getVariables()) { if (!objNames.contains(var.getName())) { errorHandler.reportError(cu, "The term ", var, " at ", facts.getPosition(), " in the external fact set ", facts.getId(), " cannot be a free variable"); } } } } } } }
From source file:org.jberet.testapps.loadBatchXml.FileSystemJobXmlResolver.java
@Override public Collection<String> getJobXmlNames(final ClassLoader classLoader) { return Collections2.transform(listFiles(), new Function<File, String>() { @Override/*from w w w . ja v a 2s . co m*/ public String apply(final File file) { return file.getName(); } }); }
From source file:brainleg.app.engine.visitor.WebSearchStringGeneratorVisitor.java
public void visit(EData data) { Collection<ELine> lines = Lists.newArrayList(Iterables.concat(data.getHeaders(), data.getTraces())); //remove disabled lines lines = Collections2.filter(lines, new Predicate<ELine>() { public boolean apply(ELine line) { return line.enabled; }/* w w w. j a v a2 s . co m*/ }); sb.append(Joiner.on("").join(Collections2.transform(lines, new Function<ELine, String>() { public String apply(ELine line) { return line.submissionText; } }))); }
From source file:com.metabroadcast.common.intl.Countries.java
public static Set<String> toCodes(Collection<Country> availableCountries) { return Sets.newHashSet(Collections2.transform(availableCountries, Country.UNPACK_COUNTRY_CODE)); }
From source file:io.pcp.parfait.dxm.semantics.PcpDimensionSet.java
<T extends PcpScale<?>> PcpDimensionSet(Class<T> unitDimension) { this.unitMappings = Collections2.transform(Arrays.asList(unitDimension.getEnumConstants()), new Function<PcpScale<?>, UnitMapping>() { @Override/*w w w . j a v a 2 s . com*/ public UnitMapping apply(PcpScale<?> from) { return new UnitMapping(from.getUnit(), PcpDimensionSet.this, from, null); } }); }
From source file:com.amazon.kinesis.streaming.agent.metrics.CompositeMetricsFactory.java
/** * @return a {@link CompositeMetricsScope} containing a scope for each * of the factories backing this composite. *///from ww w . j ava2 s . c om @Override public IMetricsScope createScope() { Collection<IMetricsScope> scopes = Collections2.transform(this.factories, new Function<IMetricsFactory, IMetricsScope>() { @Override @Nullable public IMetricsScope apply(IMetricsFactory input) { return input.createScope(); } }); return new CompositeMetricsScope(scopes); }