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:org.eigenbase.sql.SqlBinaryStringLiteral.java
protected SqlAbstractStringLiteral concat1(List<SqlLiteral> literals) { return new SqlBinaryStringLiteral(BitString.concat(Lists.transform(literals, F)), literals.get(0).getParserPosition()); }
From source file:org.jclouds.orion.blobstore.functions.parsers.response.ListContainersResponseParser.java
@Override public PageSet<? extends StorageMetadata> apply(HttpResponse res) { final List<OrionStorageMetadata> storageDataList = Lists.transform(this.folderListParser.apply(res), this.childMetadataToStorageMetadata); return new OrionPageSet(storageDataList); }
From source file:org.sonar.server.permission.ws.template.SearchTemplatesDataLoader.java
public SearchTemplatesData load(DbSession dbSession, SearchTemplatesWsRequest request) { SearchTemplatesData.Builder data = builder(); List<PermissionTemplateDto> templates = searchTemplates(dbSession, request); List<Long> templateIds = Lists.transform(templates, PermissionTemplateDto::getId); DefaultTemplates defaultTemplates = checkFoundWithOptional( dbClient.organizationDao().getDefaultTemplates(dbSession, request.getOrganizationUuid()), "No Default templates for organization with uuid '%s'", request.getOrganizationUuid()); ResolvedDefaultTemplates resolvedDefaultTemplates = defaultTemplatesResolver.resolve(defaultTemplates); data.templates(templates).defaultTemplates(resolvedDefaultTemplates) .userCountByTemplateIdAndPermission(userCountByTemplateIdAndPermission(dbSession, templateIds)) .groupCountByTemplateIdAndPermission(groupCountByTemplateIdAndPermission(dbSession, templateIds)) .withProjectCreatorByTemplateIdAndPermission( withProjectCreatorsByTemplateIdAndPermission(dbSession, templateIds)); return data.build(); }
From source file:com.prealpha.minelib.nbt.ListTag.java
@Override public ByteBuffer toBytes() { // make a copy to avoid encoding twice List<ByteBuffer> payloadBytes = ImmutableList.copyOf(Lists.transform(value, Tag.ENCODER)); int length = 5; // for the element type (1) and count (4) for (ByteBuffer buffer : payloadBytes) { length += buffer.capacity();//from w w w . j a v a 2s . c o m } ByteBuffer payload = ByteBuffer.allocate(length); payload.put(elementType.getBinaryType()); payload.putInt(value.size()); for (ByteBuffer buffer : payloadBytes) { payload.put(buffer); } payload.position(0); return payload; }
From source file:edu.buaa.satla.analysis.core.arg.MutableARGPath.java
public ImmutableSet<ARGState> getStateSet() { List<ARGState> elementList = Lists.transform(this, Pair.<ARGState>getProjectionToFirst()); return ImmutableSet.copyOf(elementList); }
From source file:io.druid.indexing.common.task.MergeTask.java
@Override public File merge(final Map<DataSegment, File> segments, final File outDir) throws Exception { return IndexMerger.mergeQueryableIndex( Lists.transform(ImmutableList.copyOf(segments.values()), new Function<File, QueryableIndex>() { @Override//from w w w . j a v a2s.com public QueryableIndex apply(@Nullable File input) { try { return IndexIO.loadIndex(input); } catch (Exception e) { throw Throwables.propagate(e); } } }), aggregators.toArray(new AggregatorFactory[aggregators.size()]), outDir, indexSpec); }
From source file:io.druid.query.groupby.orderby.OrderByColumnSpec.java
public static List<OrderByColumnSpec> descending(String... dimension) { return Lists.transform(Arrays.asList(dimension), new Function<String, OrderByColumnSpec>() { @Override/*from ww w. j av a 2 s . c o m*/ public OrderByColumnSpec apply(@Nullable String input) { return desc(input); } }); }
From source file:com.zimbra.soap.account.type.Identity.java
public Identity(Identity i) { name = i.getName(); id = i.getId(); super.setAttrs(Lists.transform(i.getAttrs(), Attr.COPY)); }
From source file:com.addthis.tutor.tree.TreeInput.java
/** * Constructs a TreeInput object from the specified input string. * * @param input - string input to read bundles from. *///from w w w . ja va 2 s. c om public TreeInput(String input, final BundleFormat format, BundleFactory bundleFactory) throws IOException { checkArgument(format.getFieldCount() == 0); this.bundleFactory = bundleFactory; this.csvParser = new CsvListReader(new StringReader(input), csvParserOptions); List<String> keys = csvParser.read(); if (keys == null) { throw new IllegalArgumentException("header row is missing"); } fields = Lists.transform(keys, new Function<String, BundleField>() { @Nullable @Override public BundleField apply(@Nullable String input) { return format.getField(input); } }); }
From source file:org.obm.push.bean.change.item.ItemChangesBuilder.java
@Override public List<ItemChange> build() { return Lists.transform(builders, new Function<ItemChange.Builder, ItemChange>() { @Override/* w ww . j a v a 2 s . co m*/ public ItemChange apply(ItemChange.Builder input) { return input.build(); } }); }