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


Java MutableList.collect方法代码示例

本文整理汇总了Java中org.eclipse.collections.api.list.MutableList.collect方法的典型用法代码示例。如果您正苦于以下问题:Java MutableList.collect方法的具体用法?Java MutableList.collect怎么用?Java MutableList.collect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.collections.api.list.MutableList的用法示例。


在下文中一共展示了MutableList.collect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: function

import org.eclipse.collections.api.list.MutableList; //导入方法依赖的package包/类
@Test
public void function()
{
    // TODO - Convert the anonymous inner class to a lambda and then a method reference
    Function<String, String> toUppercase = new Function<String, String>()
    {
        @Override
        public String valueOf(String string)
        {
            return string.toUpperCase();
        }
    };
    Assert.assertEquals("UPPERCASE", toUppercase.apply("uppercase"));
    MutableList<String> lowercase = Lists.mutable.with("a", "b", "c", "d");
    MutableList<String> uppercase = lowercase.collect(toUppercase);
    Assert.assertEquals(Arrays.asList("A", "B", "C", "D"), uppercase);
}
 
开发者ID:BNYMellon,项目名称:CodeKatas,代码行数:18,代码来源:EclipseCollectionsFunctionalInterfaceTest.java

示例2: prepare

import org.eclipse.collections.api.list.MutableList; //导入方法依赖的package包/类
@Override
public final String prepare(String sql, final Change change, final DbEnvironment env) {
    if (change != null && Objects.equals(change.getChangeType().getName(), ChangeType.STATICDATA_STR)
            && !StaticDataChangeTypeBehavior.isInsertModeStaticData(sql)) {
        return sql;
    }

    sql = CommentRemover.removeComments(sql, change != null ? change.getChangeKey().toString() : sql);
    MutableList<String> sqls = MultiLineStringSplitter.createSplitterOnSpaceAndLine("GO").valueOf(sql);

    MutableList<String> convertedSqls = sqls.collect(new Function<String, String>() {
        @Override
        public String valueOf(String object) {
            return InMemoryTranslator.this.translateStatement(object, change);
        }
    });

    return convertedSqls.makeString("\n\nGO\n\n");
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:InMemoryTranslator.java

示例3: init

import org.eclipse.collections.api.list.MutableList; //导入方法依赖的package包/类
/**
 * Putting this init here so that we can discover the file fields before running the actual rec
 */
public void init() {
    if (!this.initialized) {
        try {
            MutableList<String> fields;
            if (csvVersion == CsvStaticDataReader.CSV_V2) {
                CSVFormat csvFormat = getCsvFormat(delim, nullToken);
                this.csvreaderV2 = new CSVParser(reader, csvFormat);
                this.iteratorV2 = csvreaderV2.iterator();
                fields = ListAdapter.adapt(IteratorUtils.toList(iteratorV2.next().iterator()));
            } else {
                this.csvreaderV1 = new au.com.bytecode.opencsv.CSVReader(this.reader, this.delim);
                fields = ArrayAdapter.adapt(this.csvreaderV1.readNext());
            }

            this.fields = fields.collect(this.convertDbObjectName);
        } catch (Exception e) {
            throw new DeployerRuntimeException(e);
        }
        this.initialized = true;
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:25,代码来源:CsvReaderDataSource.java

示例4: preprocessSchemaTokens

import org.eclipse.collections.api.list.MutableList; //导入方法依赖的package包/类
private MutableList<File> preprocessSchemaTokens(MutableList<File> files, String dbSchema, final File interimFolder, DbPlatform dbPlatform) {
    // adding DBO to help w/ Sybase ASE; we should make this code more polymorphic
    String schemaSeparatorRegex = dbPlatform.isSubschemaSupported() ? "\\.(?:dbo)?\\." : "\\.";

    final Pattern dbSchemaPattern = Pattern.compile(String.format("(?i)%1$s%2$s(\\w+)", dbSchema, schemaSeparatorRegex));
    return files.collect(new Function<File, File>() {
        @Override
        public File valueOf(File file) {
            String fileContent = FileUtilsCobra.readFileToString(file);
            final Matcher matcher = dbSchemaPattern.matcher(fileContent);
            StringBuffer sb = new StringBuffer(fileContent.length());

            while (matcher.find()) {
                matcher.appendReplacement(sb, matcher.group(1));
            }
            matcher.appendTail(sb);

            File tempFile = new File(interimFolder, file.getName());
            FileUtilsCobra.writeStringToFile(tempFile, sb.toString());
            return tempFile;
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:24,代码来源:AquaRevengMain.java

示例5: getColumnValues

import org.eclipse.collections.api.list.MutableList; //导入方法依赖的package包/类
private static Set<String> getColumnValues(MutableList<UnmatchedIndexMap> rows, Function<UnmatchedIndexMap, String> valueFunction)
{
    if (!CellComparator.isFloatingPoint(valueFunction.valueOf(rows.getFirst())))
    {
        Set<String> values = UnifiedSet.newSet();
        rows.collect(valueFunction, values);
        return values;
    }
    return Collections.emptySet();
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:11,代码来源:AdaptivePartialMatcher.java

示例6: getSqlSnippets

import org.eclipse.collections.api.list.MutableList; //导入方法依赖的package包/类
private MutableList<String> getSqlSnippets(File file) {
    final MutableList<String> dataLines;
    dataLines = FileUtilsCobra.readLines(file);

    dataLines.forEachWithIndex(new ObjectIntProcedure<String>() {
        @Override
        public void value(String line, int i) {
            if (!line.isEmpty() && line.charAt(0) == '\uFEFF') {
                dataLines.set(i, dataLines.get(i).substring(1));
            }
            if (line.startsWith("--------------------")
                    && dataLines.get(i + 1).startsWith("-- DDL Statements")
                    && dataLines.get(i + 2).startsWith("--------------------")) {
                dataLines.set(i, "");
                dataLines.set(i + 1, "");
                dataLines.set(i + 2, "");
            } else if (line.startsWith("--------------------")
                    && dataLines.get(i + 2).startsWith("-- DDL Statements")
                    && dataLines.get(i + 4).startsWith("--------------------")) {
                dataLines.set(i, "");
                dataLines.set(i + 1, "");
                dataLines.set(i + 2, "");
                dataLines.set(i + 3, "");
                dataLines.set(i + 4, "");
            } else if (line.startsWith("-- DDL Statements for ")) {
                dataLines.set(i, "");
            }

            // For PostgreSQL
            if ((line.equals("--")
                    && dataLines.get(i + 1).startsWith("-- Name: ")
                    && dataLines.get(i + 2).equals("--"))) {
                dataLines.set(i, "");
                dataLines.set(i + 1, "GO");
                dataLines.set(i + 2, "");
            }
        }
    });

    MutableList<String> sqlSnippets;
    if (stringSplitter != null) {
        String data = dataLines
                .reject(skipLinePredicates != null ? Predicates.or(skipLinePredicates) : (Predicate) Predicates.alwaysFalse())
                .makeString(SystemUtils.LINE_SEPARATOR);

        sqlSnippets = stringSplitter.valueOf(data);
    } else {
        // If null, then default each line to being its own parsable statement
        sqlSnippets = dataLines
                .reject(skipLinePredicates != null ? Predicates.or(skipLinePredicates) : (Predicate) Predicates.alwaysFalse());
    }

    sqlSnippets = sqlSnippets.collect(new Function<String, String>() {
        @Override
        public String valueOf(String sqlSnippet) {
            return StringUtils.stripStart(sqlSnippet, "\r\n \t");
        }
    });
    sqlSnippets = sqlSnippets.select(StringPredicates.notBlank().and(Predicates.noneOf(skipPredicates)));
    return sqlSnippets;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:62,代码来源:AbstractDdlReveng.java


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