当前位置: 首页>>代码示例>>Java>>正文


Java Lambda.convert方法代码示例

本文整理汇总了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;
}
 
开发者ID:nerdammer,项目名称:spash,代码行数:35,代码来源:SpashCommandCompleter.java

示例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);
        }
    }));
}
 
开发者ID:nerdammer,项目名称:spash,代码行数:10,代码来源:SpashCollectionListAdapter.java

示例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());
        }
    }
}
 
开发者ID:nerdammer,项目名称:spash,代码行数:39,代码来源:ExpressionTokenizer.java

示例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);
        }
    });
}
 
开发者ID:SEEG-Oxford,项目名称:ABRAID-MP,代码行数:9,代码来源:GeoJsonDiseaseOccurrenceFeatureCollection.java

示例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());
        }
    });
}
 
开发者ID:SEEG-Oxford,项目名称:ABRAID-MP,代码行数:9,代码来源:MainControllerIntegrationTest.java

示例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();
        }
    });
}
 
开发者ID:SEEG-Oxford,项目名称:ABRAID-MP,代码行数:15,代码来源:HealthMapAlertConverter.java

示例7: columnSizes

import ch.lambdaj.Lambda; //导入方法依赖的package包/类
public List<Integer> columnSizes() {
    return Lambda.convert(this.values, new StringLengthConverter());
}
 
开发者ID:nerdammer,项目名称:spash,代码行数:4,代码来源:TabulatedValue.java


注:本文中的ch.lambdaj.Lambda.convert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。