本文整理汇总了Java中com.google.common.collect.Lists.transform方法的典型用法代码示例。如果您正苦于以下问题:Java Lists.transform方法的具体用法?Java Lists.transform怎么用?Java Lists.transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.Lists
的用法示例。
在下文中一共展示了Lists.transform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bufferHelper
import com.google.common.collect.Lists; //导入方法依赖的package包/类
private static void bufferHelper(String input, String... expect)
throws IOException {
List<String> expectProcess = Arrays.asList(expect);
List<String> expectRead = Lists.transform(expectProcess,
new Function<String, String>() {
@Override
public String apply(String value) {
return value.replaceAll("[\\r\\n]", "");
}
});
for (int chunk : CHUNK_SIZES) {
chunk = Math.max(1, Math.min(chunk, input.length()));
assertEquals(expectProcess, bufferHelper(input, chunk));
assertEquals(expectRead, readUsingJava(input, chunk));
assertEquals(expectRead, readUsingReader(input, chunk, true));
assertEquals(expectRead, readUsingReader(input, chunk, false));
}
}
示例2: searchTerms
import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public Pair<Long, List<TermResult>> searchTerms(Taxonomy taxonomy, String query, SelectionRestriction restriction,
int limit, boolean searchFullTerms)
{
final String searchField = (searchFullTerms ? "fullValue" : "value");
final Criterion c1 = Restrictions.eq("taxonomy", taxonomy);
final Criterion c2 = Restrictions.ilike(searchField, query.replace('*', '%'));
final Criterion c3 = getSearchRestrictionCriterion(restriction);
final long totalCount = termDao.countByCriteria(c1, c2, c3);
List<TermResult> results = Collections.emptyList();
if( totalCount > 0 )
{
List<Term> terms = termDao.findAllByCriteria(Order.asc(searchField), -1, limit, c1, c2, c3);
results = Lists.transform(terms, new Function<Term, TermResult>()
{
@Override
public TermResult apply(Term term)
{
return new TermResult(term.getValue(), term.getFullValue(), term.isLeaf());
}
});
}
return new Pair<Long, List<TermResult>>(totalCount, results);
}
示例3: getResults
import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public List<ItemScriptType> getResults()
{
if( resultList == null )
{
resultList = Lists.transform(results.getResults(), new Function<Item, ItemScriptType>()
{
@Override
public ItemScriptType apply(Item item)
{
return new ItemScriptTypeImpl(itemService, itemHelper, item);
}
});
}
return resultList;
}
示例4: getCurrentSelectedRoles
import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public List<SelectedRole> getCurrentSelectedRoles(final SectionInfo info)
{
return Lists.transform(storageControl.getValues(), new Function<String, SelectedRole>()
{
@Override
public SelectedRole apply(String id)
{
final RoleBean roleBean = userService.getInformationForRole(id);
final String displayName;
if( roleBean == null )
{
displayName = id;
}
else
{
displayName = Format.format(roleBean);
}
return new SelectedRole(id, displayName);
}
});
}
示例5: partitionValues
import com.google.common.collect.Lists; //导入方法依赖的package包/类
public Optional<List<BytesRef>> partitionValues() {
if (partitionIdx == null || partitionIdx.isEmpty()) {
return Optional.absent();
}
List<BytesRef> values = Lists.transform(partitionIdx, new Function<Integer, BytesRef>() {
@Nullable
@Override
public BytesRef apply(Integer input) {
return ValueSymbolVisitor.BYTES_REF.process(key.get(input));
}
});
return Optional.of(values);
}
示例6: getSecurityTargetsAsTreeNodes
import com.google.common.collect.Lists; //导入方法依赖的package包/类
public static List<SecurityTreeNode> getSecurityTargetsAsTreeNodes(final PluginService pluginService,
final RemotePrivilegeTreeService service, final SecurityTarget target)
{
return Lists.transform(service.getChildTargets(target), new Function<SecurityTarget, SecurityTreeNode>()
{
@Override
public SecurityTreeNode apply(SecurityTarget input)
{
return new DynamicPrivilegeTreeNode(pluginService, service, input);
}
});
}
示例7: newInstance
import com.google.common.collect.Lists; //导入方法依赖的package包/类
public static DatasetSummary newInstance(DatasetConfig datasetConfig, int jobCount, int descendants)
throws NamespaceException {
List<String> fullPath = datasetConfig.getFullPathList();
DatasetType datasetType = datasetConfig.getType();
List<Field> fields;
DatasetVersion datasetVersion;
List<com.dremio.dac.model.common.Field> fieldList = DatasetsUtil.getFieldsFromDatasetConfig(datasetConfig);
if (fieldList == null) {
fields = null;
} else {
fields = Lists.transform(fieldList, new Function<com.dremio.dac.model.common.Field, Field>() {
@Override
public Field apply(com.dremio.dac.model.common.Field input) {
return new Field(input.getName(), input.getType().name());
}
});
}
if (datasetType == DatasetType.VIRTUAL_DATASET) {
final VirtualDataset virtualDataset = datasetConfig.getVirtualDataset();
datasetVersion = virtualDataset.getVersion();
} else {
datasetVersion = null;
}
return new DatasetSummary(fullPath, jobCount, descendants, fields, datasetType, datasetVersion);
}
示例8: getScenarios
import com.google.common.collect.Lists; //导入方法依赖的package包/类
public List<MeasuredOperationList> getScenarios() {
return Lists.transform(getKnownVersions(), new Function<String, MeasuredOperationList>() {
public MeasuredOperationList apply(String version) {
return result.version(version).getResults();
}
});
}
示例9: call
import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public List<NameValue> call()
{
final CloudFacetSearchResults searchResults = facetSearch(facet);
final List<NameValue> nameVals = new ArrayList<>(
Lists.transform(searchResults.getResults(), getTransformer()));
clean(nameVals);
Collections.sort(nameVals, new NameValueComparator());
return nameVals;
}
示例10: resultsToRequests
import com.google.common.collect.Lists; //导入方法依赖的package包/类
static List<RaycastRequest> resultsToRequests( List<PrecomputedRaycastResult> results ) {
return Lists.transform(
results,
new Function<PrecomputedRaycastResult, RaycastRequest>() {
@Override
public RaycastRequest apply(PrecomputedRaycastResult input) {
return input.request;
}
}
);
}
示例11: relDataTypeToFieldType
import com.google.common.collect.Lists; //导入方法依赖的package包/类
public static List<FieldType> relDataTypeToFieldType(final RelDataType rowType) {
return Lists.transform(rowType.getFieldList(), new Function<RelDataTypeField, FieldType>() {
@Nullable
@Override
public FieldType apply(@Nullable final RelDataTypeField field) {
return new FieldType(field.getName(), field.getType());
}
});
}
示例12: generateInstanceMethodOverridesForRequestOptions
import com.google.common.collect.Lists; //导入方法依赖的package包/类
private List<MethodSpec> generateInstanceMethodOverridesForRequestOptions() {
return Lists.transform(
processorUtil.findInstanceMethodsReturning(requestOptionsType, requestOptionsType),
new Function<ExecutableElement, MethodSpec>() {
@Override
public MethodSpec apply(ExecutableElement input) {
return generateRequestOptionOverride(input);
}
});
}
示例13: listPatchSchedules
import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public List<ScheduleEntry> listPatchSchedules() {
RedisPatchScheduleInner patchSchedules = this.manager().inner().patchSchedules().get(resourceGroupName(), name());
if (patchSchedules != null) {
return Lists.transform(patchSchedules.scheduleEntries(),
new Function<ScheduleEntryInner, ScheduleEntry>() {
public ScheduleEntry apply(ScheduleEntryInner entryInner) {
return new ScheduleEntry(entryInner);
}
});
}
return null;
}
示例14: toIdList
import com.google.common.collect.Lists; //导入方法依赖的package包/类
public static List<Integer> toIdList(List<MediaFile> from) {
return Lists.transform(from, toId());
}
示例15: getPortalLayout
import com.google.common.collect.Lists; //导入方法依赖的package包/类
private synchronized Pair<List<SectionId>, List<SectionId>> getPortalLayout(RenderEventContext context)
{
if( portletLayout == null )
{
List<LayoutData> left = new ArrayList<LayoutData>();
List<LayoutData> right = new ArrayList<LayoutData>();
List<LayoutData> dynamic = new ArrayList<LayoutData>();
List<SectionId> childIds = context.getChildIds(this);
for( SectionId childId : childIds )
{
LayoutData data = new LayoutData();
String idStr = childId.getSectionId();
data.setSectionId(childId);
String layout = context.getLayout(idStr);
try
{
JSONObject json = JSONObject.fromObject(layout);
data.setOrder(json.getInt("order")); //$NON-NLS-1$
if( json.get("column").equals("dynamic") ) //$NON-NLS-1$//$NON-NLS-2$
{
dynamic.add(data);
}
else
{
(json.get("column").equals("left") ? left : right).add(data); //$NON-NLS-1$ //$NON-NLS-2$
}
}
catch( RuntimeException ex )
{
throw new SectionsRuntimeException("The layout property for " + childId
+ " is missing or incorrect. Must be in JSON format with properties"
+ " \"{order: 1234, column: 'left'|'right'}\", but it was \"" + layout + "\"", ex);
}
}
Collections.sort(left, NumberOrderComparator.LOWEST_FIRST);
Collections.sort(right, NumberOrderComparator.LOWEST_FIRST);
portletLayout = new Pair<List<SectionId>, List<SectionId>>(Lists.transform(left, DATA_TO_SECTION_ID),
Lists.transform(right, DATA_TO_SECTION_ID));
dymanicPortals = Lists.transform(dynamic, DATA_TO_SECTION_ID);
}
return portletLayout;
}