本文整理汇总了Java中ch.lambdaj.Lambda.convert方法的典型用法代码示例。如果您正苦于以下问题:Java Lambda.convert方法的具体用法?Java Lambda.convert怎么用?Java Lambda.convert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ch.lambdaj.Lambda
的用法示例。
在下文中一共展示了Lambda.convert方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: complete
import ch.lambdaj.Lambda; //导入方法依赖的package包/类
@Override
public int complete(String buffer, int cursor, List<CharSequence> candidates) {
Preconditions.checkNotNull(candidates);
String text = contextualBuffer(buffer, cursor);
List<String> commands = Lambda.filter(StringStartsWith.startsWith(text), this.commands);
if(commands.size()>0) {
candidates.addAll(commands);
if(candidates.size()==1) {
candidates.set(0, candidates.get(0) + " ");
}
return candidates.isEmpty() ? -1 : 0;
} else if(text.contains(" ")) {
int insertion = text.lastIndexOf(" ") + 1;
String tailBuffer = text.substring(insertion);
List<String> files = Lambda.convert(Lambda.convert(SpashFileSystem.get().ls(this.session.getWorkingDir()).collect(), new PropertyExtractor<Object, Path>("fileName")), new DefaultStringConverter());
files = Lambda.filter(StringStartsWith.startsWith(tailBuffer), files);
candidates.addAll(files);
if(candidates.size()==1) {
candidates.set(0, candidates.get(0) + " ");
}
return candidates.isEmpty() ? -1 : insertion;
}
return -1;
}
示例2: map
import ch.lambdaj.Lambda; //导入方法依赖的package包/类
@Override
public <R> SpashCollection<R> map(final SerializableFunction<T, R> f) {
return new SpashCollectionListAdapter<>(Lambda.convert(target, new Converter<T, R>() {
@Override
public R convert(T t) {
return f.apply(t);
}
}));
}
示例3: ExpressionTokenizer
import ch.lambdaj.Lambda; //导入方法依赖的package包/类
public ExpressionTokenizer(String arg) {
if(arg==null) {
throw new IllegalArgumentException("Null string");
}
if(containsUnquoted(arg, "||")) {
throw new IllegalArgumentException("Unexpected sequence: '||'");
}
if(containsUnquoted(arg, ">>>")) {
throw new IllegalArgumentException("Unexpected sequence: '>>>'");
}
List<String> piped = splitUnquoted(arg, "|");
LinkedList<String> exprs = new LinkedList<>(Lambda.convert(piped, new Converter<String, String>() {
@Override
public String convert(String s) {
return s.trim();
}
}));
this.commandStrings = new ArrayList<>();
while(!exprs.isEmpty()) {
String expr = exprs.poll();
Integer start = minPositive(indexOfUnquoted(expr, " "), indexOfUnquoted(expr, "\t"), indexOfUnquoted(expr, "\r"), indexOfUnquoted(expr, "\n"));
if(start==null) {
this.commandStrings.add(expr.trim());
continue;
}
int idx = indexOfUnquoted(expr, ">", start);
if(idx>0) {
String first = expr.substring(0, idx).trim();
this.commandStrings.add(first);
exprs.addFirst(expr.substring(idx).trim());
} else {
this.commandStrings.add(expr.trim());
}
}
}
示例4: extractOccurrenceFeatures
import ch.lambdaj.Lambda; //导入方法依赖的package包/类
private static List<GeoJsonDiseaseOccurrenceFeature> extractOccurrenceFeatures(
List<DiseaseOccurrence> occurrences) {
return Lambda.convert(occurrences, new Converter<DiseaseOccurrence, GeoJsonDiseaseOccurrenceFeature>() {
public GeoJsonDiseaseOccurrenceFeature convert(DiseaseOccurrence occurrence) {
return new GeoJsonDiseaseOccurrenceFeature(occurrence);
}
});
}
示例5: prepend
import ch.lambdaj.Lambda; //导入方法依赖的package包/类
private List<String> prepend(final String prefix, List<Object> from) {
return Lambda.convert(from, new Converter<Object, String>() {
@Override
public String convert(Object s) {
return prefix + (s.toString());
}
});
}
示例6: HealthMapAlertConverter
import ch.lambdaj.Lambda; //导入方法依赖的package包/类
public HealthMapAlertConverter(AlertService alertService, EmailService emailService,
HealthMapLookupData lookupData, HealthMapService healthMapService,
List<String> placeCategoriesToIgnore) {
this.alertService = alertService;
this.emailService = emailService;
this.lookupData = lookupData;
this.healthMapService = healthMapService;
this.placeCategoriesToIgnore = Lambda.convert(placeCategoriesToIgnore, new Converter<String, String>() {
@Override
public String convert(String place) {
return place.toLowerCase();
}
});
}
示例7: columnSizes
import ch.lambdaj.Lambda; //导入方法依赖的package包/类
public List<Integer> columnSizes() {
return Lambda.convert(this.values, new StringLengthConverter());
}