• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MutableList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



MutableList类属于org.eclipse.collections.api.list包,在下文中一共展示了MutableList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseFromProperties

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
public static MutableCollection<DbMergeInfo> parseFromProperties(Configuration config) {
    Set<String> dbs = new HashSet<String>(config.getList("instances"));

    MutableList<DbMergeInfo> dbMergeInfos = Lists.mutable.empty();
    for (String db : dbs) {
        Configuration subset = config.subset(db);
        if (subset.containsKey("inputDir")) {
            File inputDir = new File(subset.getString("inputDir"));
            DbMergeInfo mergeInfo = new DbMergeInfo(db, inputDir);
            if (subset.containsKey("driverClassName")) {
                mergeInfo.setDriverClassName(subset.getString("driverClassName"));
                mergeInfo.setUrl(subset.getString("url"));
                mergeInfo.setUsername(subset.getString("username"));
                mergeInfo.setPassword(subset.getString("password"));
                mergeInfo.setPhysicalSchema(subset.getString("physicalSchema"));
            }

            dbMergeInfos.add(mergeInfo);
        }
    }

    return dbMergeInfos;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:24,代码来源:DbMergeInfo.java


示例2: predicateIsOdd

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
@Test
public void predicateIsOdd()
{
    MutableList<Integer> numbers = Interval.oneTo(10).toList();

    // TODO - Convert the anonymous inner class to a lambda
    Predicate<Integer> oddPredicate = new Predicate<Integer>()
    {
        @Override
        public boolean accept(Integer integer)
        {
            return integer % 2 == 1;
        }
    };
    Assert.assertFalse(oddPredicate.test(2));
    Assert.assertTrue(oddPredicate.test(1));
    MutableList<Integer> odds = numbers.select(oddPredicate);
    Assert.assertTrue(odds.allSatisfy(oddPredicate));
    Assert.assertTrue(odds.stream().allMatch(oddPredicate));
    Assert.assertFalse(odds.noneSatisfy(oddPredicate));
    Assert.assertFalse(odds.stream().noneMatch(oddPredicate));
    Assert.assertTrue(odds.stream().anyMatch(oddPredicate));
    Assert.assertTrue(odds.anySatisfy(oddPredicate));
    Assert.assertEquals(Interval.oddsFromTo(1, 10), odds);
}
 
开发者ID:BNYMellon,项目名称:CodeKatas,代码行数:26,代码来源:EclipseCollectionsFunctionalInterfaceTest.java


示例3: 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


示例4: convert

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
public static Predicates<? super String> convert(ImmutableCollection<String> patterns) {
    if (patterns == null) {
        return Predicates.alwaysTrue();
    }
    PartitionIterable<String> wildcardPartition = patterns.partition(Predicates.or(StringPredicates.contains("*"), StringPredicates.contains("%")));
    RichIterable<String> wildcardPatterns = wildcardPartition.getSelected();
    RichIterable<WildcardPatternIndex> wildcardPatternIndexes = wildcardPatterns.collect(new Function<String, WildcardPatternIndex>() {
        @Override
        public WildcardPatternIndex valueOf(String pattern) {
            return new WildcardPatternIndex(pattern);
        }
    });

    RichIterable<String> lookupPatterns = wildcardPartition.getRejected();
    LookupIndex lookupIndex = lookupPatterns.notEmpty() ? new LookupIndex(lookupPatterns.toSet().toImmutable()) : null;

    MutableList<Index> indexes = Lists.mutable.empty();
    if (lookupIndex != null) {
        indexes.add(lookupIndex);
    }
    indexes.withAll(wildcardPatternIndexes);

    return Predicates.or(indexes);
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:25,代码来源:LookupPredicateBuilder.java


示例5: IqLoadFileCreator

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
public IqLoadFileCreator(String tableName, MutableList<FieldToColumnMapping> fieldToColumnMappings, File iqLoadDir,
        String loadFilePrefix, IqLoadMode iqLoadMode, DataExtractor dataExtractor) {
    this.tableName = tableName;

    PartitionMutableList<FieldToColumnMapping> parsedMappings =
            fieldToColumnMappings.partition(Predicates.attributeIsNull(FieldToColumnMapping.defaultValue()));

    this.mappingsWithoutDefaults = parsedMappings.getSelected();
    this.mappingsWithDefaults = parsedMappings.getRejected();
    this.iqLoadDir = iqLoadDir;
    this.loadFilePrefix = loadFilePrefix;
    this.cub.register(new SybaseIqLoadFieldConverter(), String.class);
    this.iqLoadMode = iqLoadMode;
    this.dataExtractor = dataExtractor;
    this.fileToWrite = new File(this.getFilePath());
    this.filePathToLoad =
            iqLoadMode.isConvertToWindowsFileSyntax() ? this.getFilePath().replace("\\", "\\\\") : this.getFilePath()
                    .replace("\\", "/");
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:IqLoadFileCreator.java


示例6: getTableDrops

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
private ImmutableCollection<DbCleanCommand> getTableDrops(DaCatalog database, final PhysicalSchema physicalSchema) {
    final ChangeType viewType = this.env.getPlatform().getChangeType(ChangeType.VIEW_STR);
    final ChangeType fkType = this.env.getPlatform().getChangeType(ChangeType.FOREIGN_KEY_STR);
    final ChangeType tableType = this.env.getPlatform().getChangeType(ChangeType.TABLE_STR);
    return database.getTables().flatCollect(new Function<DaTable, Iterable<DbCleanCommand>>() {
        @Override
        public Iterable<DbCleanCommand> valueOf(DaTable table) {
            if (table.isView()) {
                return Lists.immutable.with(new DbCleanCommand(physicalSchema, viewType, table.getName()));
            } else {
                MutableList<DbCleanCommand> cleanCommands = Lists.mutable.empty();
                for (DaForeignKey foreignKey : table.getImportedForeignKeys()) {
                    cleanCommands.add(new DbCleanCommand(physicalSchema, fkType, table.getName(),
                            "ALTER TABLE " + table.getName() + " DROP CONSTRAINT " + foreignKey.getName()));
                }

                cleanCommands.add(new DbCleanCommand(physicalSchema, tableType, table.getName()));

                return cleanCommands;
            }
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:24,代码来源:DbEnvironmentCleaner.java


示例7: cleanEnvironment

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
@Override
public void cleanEnvironment(final boolean noPrompt) {
    Validate.isTrue(env.isCleanBuildAllowed(), "Clean build not allowed for this environment [" + env.getName()
            + "] ! Exiting...");

    // some schemas have complex dependencies that we currently aren't handling w/ the drop code. To work
    // around it, we just retry the drop if we have progress in dropping objects.
    // Note that regular forward deploys can handle dependencies properly; we just need the logic to extract
    // the object definitions out for all object types to enable this.
    int tryCount = 0;
    while (true) {
        tryCount++;
        LOG.info("Attempting to clean objects from environment");
        final Pair<Boolean, MutableList<Exception>> clearResults = clearEnvironmentInternal(noPrompt);
        if (!clearResults.getOne()) {
            throw new DeployerRuntimeException("Could not clean schema; remaining exceptions: " + clearResults.getTwo().collect(TO_EXCEPTION_STACK_TRACE));
        } else if (clearResults.getTwo().isEmpty()) {
            return;
        } else if (tryCount <= 10) {
            LOG.info("Failed to clean up schema on try #" + tryCount + " but able to make progress, will continue to try");
        } else {
            throw new DeployerRuntimeException("Could not clean schema after max " + tryCount + " tries; will exit with remaining exceptions: " + clearResults.getTwo().collect(TO_EXCEPTION_STACK_TRACE));
        }
    }

}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:27,代码来源:DbEnvironmentCleaner.java


示例8: valueOf

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
public ImmutableList<ArtifactRestrictions> valueOf(TextMarkupDocumentSection section) {
    if (section == null) {
        return Lists.immutable.of();
    }

    MutableList<ArtifactRestrictions> restrictions = Lists.mutable.empty();

    Twin<MutableSet<String>> envRestrictions = readRestrictions(section, TextMarkupDocumentReader.INCLUDE_ENVS, TextMarkupDocumentReader.EXCLUDE_ENVS);
    if (envRestrictions != null) {
        restrictions.add(new ArtifactEnvironmentRestrictions(envRestrictions.getOne(), envRestrictions.getTwo()));
    }

    Twin<MutableSet<String>> platformRestrictions = readRestrictions(section, TextMarkupDocumentReader.INCLUDE_PLATFORMS, TextMarkupDocumentReader.EXCLUDE_PLATFORMS);
    if (platformRestrictions != null) {
        restrictions.add(new ArtifactPlatformRestrictions(platformRestrictions.getOne(), platformRestrictions.getTwo()));
    }

    return restrictions.toImmutable();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:DbChangeRestrictionsReader.java


示例9: parseString

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
private ImmutableList<TextMarkupDocumentSection> parseString(String text, ImmutableList<String> elementsToCheck, final boolean recurse,
        final String elementPrefix) {

    MutableList<Pair<String, String>> outerSections = splitIntoMainSections(text, elementsToCheck, elementPrefix);

    MutableList<TextMarkupDocumentSection> sections = outerSections.flatCollect(new ConvertOuterSectionToTextSection(recurse, elementPrefix));

    // remove any blank sections
    return sections.toImmutable().reject(new Predicate<TextMarkupDocumentSection>() {
        @Override
        public boolean accept(TextMarkupDocumentSection each) {
            return recurse && each.getName() == null
                    && (StringUtils.isBlank(each.getContent())
                    || StringUtils.isBlank(CommentRemover.removeComments(each.getContent(), "removing on markup document reader"))  // need comments in a separate clause as CommentRemover returns a "null" string on null; will fix eventually
            );
        }
    });
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:TextMarkupDocumentReader.java


示例10: sortSqls

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
private MutableList<String> sortSqls(MutableList<String> sqls) {
    MutableList<String> orderedSqls = Lists.mutable.empty();
    MutableList<String> fkSqls = Lists.mutable.empty();
    MutableList<String> triggerSqls = Lists.mutable.empty();

    for (String sql : sqls) {
        Matcher matcher = RegexpPatterns.fkPattern.matcher(sql);
        Matcher triggerMatcher = RegexpPatterns.triggerPattern.matcher(sql);
        if (matcher.find()) {
            fkSqls.add(sql);
        } else if (triggerMatcher.find()) {
            triggerSqls.add(sql);
        } else {
            orderedSqls.add(sql);
        }
    }

    orderedSqls.addAll(fkSqls);
    orderedSqls.addAll(triggerSqls);
    return orderedSqls;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:22,代码来源:BaselineTableChangeParser.java


示例11: testSimpleViews

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
@Test
public void testSimpleViews() {
    Change view1Dep = new ChangeRerunnable(viewChangeType(), "schema", "viewA", "hash", CONTENT);
    Change view1Src = new ChangeRerunnable(viewChangeType(), "schema", "viewA", "hashdiff", CONTENT);
    Change view2Dep = new ChangeRerunnable(viewChangeType(), "schema", "viewB", "samehash", CONTENT);
    Change view2Src = new ChangeRerunnable(viewChangeType(), "schema", "viewB", "samehash", CONTENT);
    Change view3Dep = new ChangeRerunnable(viewChangeType(), "schema", "viewC", "deletion", CONTENT);
    Change view4Src = new ChangeRerunnable(viewChangeType(), "schema", "viewD", "addition", CONTENT);

    MutableList<Change> allSourceChanges = Lists.mutable.with(
            view1Src, view2Src, view4Src
    );

    ListIterable<ChangeCommand> changeset = cmdCalc.calculateCommands(viewChangeType(), Lists.mutable.of(
            new ChangePair(view1Src, view1Dep)
            , new ChangePair(view2Src, view2Dep)
            , new ChangePair(null, view3Dep)
            , new ChangePair(view4Src, null)
    ), allSourceChanges, false, false);

    assertEquals(3, changeset.size());
    Verify.assertAnySatisfy(changeset, assertValue(DeployChangeCommand.class, view1Src));
    Verify.assertAnySatisfy(changeset, assertValue(DeployChangeCommand.class, view4Src));
    Verify.assertAnySatisfy(changeset, assertValue(DropObjectChangeCommand.class, view3Dep));
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:26,代码来源:RerunnableChangeTypeCommandCalculatorTest.java


示例12: executeDeletes

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
/**
 * See executeInserts javadoc for why we don't leverage batching here
 */
protected void executeDeletes(Connection conn, StaticDataChangeRows changeRows) {
    for (StaticDataDeleteRow delete : changeRows.getDeleteRows()) {
        MutableList<Object> paramVals = Lists.mutable.empty();
        MutableList<String> whereClauseParts = Lists.mutable.empty();

        for (Pair<String, Object> stringObjectPair : delete.getWhereParams().keyValuesView()) {
            String column = stringObjectPair.getOne();
            Object value = stringObjectPair.getTwo();
            whereClauseParts.add(column + " = ?");
            paramVals.add(value);
        }

        String sql = "DELETE FROM " + dbPlatform.getSchemaPrefix(changeRows.getSchema()) + changeRows.getTable().getName() +
                " WHERE " + whereClauseParts.makeString(" AND ");
        LOG.info("DELETING: " + sql + ":" + paramVals.makeString(", "));
        this.jdbcTemplate.update(conn, sql, paramVals.toArray());
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:22,代码来源:CsvStaticDataDeployer.java


示例13: recompileInvalidObjects

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
private void recompileInvalidObjects(RichIterable<PhysicalSchema> physicalSchemas) {
    MutableList<String> warnings = Lists.mutable.empty();
    for (final PhysicalSchema physicalSchema : physicalSchemas) {
        try {
            this.stmtExecutor.executeWithinContext(physicalSchema, new Procedure<Connection>() {
                @Override
                public void value(Connection conn) {
                    stmtExecutor.getJdbcTemplate().update(conn, "CALL SYSPROC.ADMIN_REVALIDATE_DB_OBJECTS(NULL, '" + physicalSchema.getPhysicalName() + "', NULL)");
                }
            });
            LOG.info("Successfully recompiled objects in schema", physicalSchema);
        } catch (DataAccessException e) {
            warnings.add(physicalSchema.getPhysicalName() + ": " + e.getMessage());
            LOG.warn("Failed to recompile objects on schema {}; will not fail the overall deployment due to this", physicalSchema, e);
        }
    }

    if (warnings.notEmpty()) {
        deployMetricsCollector.addMetric(POST_DEPLOY_WARNINGS, "Failures on recompiling invalid objects: " + warnings.makeString("\n"));
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:22,代码来源:Db2PostDeployAction.java


示例14: handleChanges

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
private MutableList<ExecuteChangeCommand> handleChanges(MutableCollection<Change> fromSourceList) {
    final MutableList<ExecuteChangeCommand> commands = Lists.mutable.empty();

    DirectedGraph<Change, DefaultEdge> graph = enricher.createDependencyGraph(fromSourceList, false);

    if (graph != null) {
        ConnectivityInspector<Change, DefaultEdge> connectivityInspector
                = new ConnectivityInspector<Change, DefaultEdge>(graph);
        for (Set<Change> connectedSet : connectivityInspector.connectedSets()) {
            // once we have a connectedSet, sort within those changes to ensure that we still sort them in the
            // right order (i.e. via topological sort)
            ImmutableList<Change> fullChanges = sorter.sortChanges(graph, SetAdapter.adapt(connectedSet), SortableDependency.GRAPH_SORTER_COMPARATOR);
            commands.add(changeCommandFactory.createDeployCommand(new GroupChange(fullChanges)));
        }
    }

    return commands;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:StaticDataChangeTypeCommandCalculator.java


示例15: addMatchedRecord

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
private static void addMatchedRecord(IndexMap rowIndexMap, MutableList<ResultCell> row, IndexMap colIndexMap, VerifiableTable actualData, VerifiableTable expectedData, ColumnComparators columnComparators)
{
    if (colIndexMap.isMissing())
    {
        addMissingRecord(rowIndexMap, row, colIndexMap, expectedData, columnComparators);
    }
    else if (colIndexMap.isSurplus())
    {
        addSurplusRecord(rowIndexMap, row, colIndexMap, actualData, columnComparators);
    }
    else
    {
        CellComparator comparator = columnComparators.getComparator(expectedData.getColumnName(colIndexMap.getExpectedIndex()));
        Object actual = actualData.getValueAt(rowIndexMap.getActualIndex(), colIndexMap.getActualIndex());
        Object expected = expectedData.getValueAt(rowIndexMap.getExpectedIndex(), colIndexMap.getExpectedIndex());
        ResultCell comparisonResult = ResultCell.createMatchedCell(comparator, actual, expected);
        boolean outOfOrder = rowIndexMap.isOutOfOrder() || colIndexMap.isOutOfOrder();
        // todo: modify comparator to handle out-of-order state internally
        if (outOfOrder && comparisonResult.isMatch())
        {
            comparisonResult = ResultCell.createOutOfOrderCell(comparator.getFormatter(), actual);
        }
        row.add(comparisonResult);
    }
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:26,代码来源:IndexMapTableVerifier.java


示例16: getKeyCols

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
private static MutableList<String> getKeyCols(DaTable tableInfo) {
    MutableList<String> keyCols = Lists.mutable.empty();
    DaIndex pk = tableInfo.getPrimaryKey();
    for (DaIndex index : tableInfo.getIndices()) {
        if (index.isUnique()) {
            pk = index;
            break;
        }
    }
    if (pk != null) {
        for (DaColumn col : pk.getColumns()) {
            keyCols.add(col.getName());
        }
    }
    return keyCols;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:17,代码来源:DbDataComparisonUtil.java


示例17: matchingErrorPropagates

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
@Test
public void matchingErrorPropagates()
{
    PartialMatcher dyingMatcher = new PartialMatcher()
    {
        @Override
        public void match(MutableList<UnmatchedIndexMap> allMissingRows, MutableList<UnmatchedIndexMap> allSurplusRows, MutableList<IndexMap> matchedColumns)
        {
            throw new NoSuchMethodError();
        }
    };
    try
    {
        new TimeBoundPartialMatcher(dyingMatcher, Long.MAX_VALUE).match(null, null, null);
        Assert.fail();
    }
    catch (RuntimeException e)
    {
        Assert.assertTrue(e.getCause() instanceof NoSuchMethodError);
    }
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:22,代码来源:TimeBoundPartialMatcherTest.java


示例18: parseSinglePredicate

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
@VisibleForTesting
static Predicate<? super Change> parseSinglePredicate(String singlePredicateString) {
    MutableList<String> changeParts = ArrayAdapter.adapt(singlePredicateString.split(SINGLE_PREDICATE_SPLITTER));
    if (changeParts.size() > 4) {
        throw new IllegalArgumentException("Cannot have more than 4 parts here (i.e. splits via the tilde ~)");
    }

    ImmutableList<String> schemas = changeParts.size() > 0 ? parseSinglePredicatePart(changeParts.get(0)) : null;
    ImmutableList<String> changeTypes = changeParts.size() > 1 ? parseSinglePredicatePart(changeParts.get(1)) : null;
    ImmutableList<String> objectNames = changeParts.size() > 2 ? parseSinglePredicatePart(changeParts.get(2)) : null;
    ImmutableList<String> changeNames = changeParts.size() > 3 ? parseSinglePredicatePart(changeParts.get(3)) : null;

    return newBuilder()
            .setSchemas(schemas)
            .setChangeTypes(changeTypes)
            .setObjectNames(objectNames)
            .setChangeNames(changeNames)
            .build();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:20,代码来源:ChangeKeyPredicateBuilder.java


示例19: validateNoBaselineBreaks

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
public void validateNoBaselineBreaks(DbDeployerAppContext appContext, Predicate<? super CompareBreak> breakIgnorePredicate) {
    MutableList<CompareBreak> sortedCompareBreaks = this.calculateBaselineBreaks(appContext).toList().sortThis(
            Comparators.fromFunctions(
                    CompareBreak.TO_COMPARE_SUBJECT,
                    Functions.chain(CompareBreak.TO_CLAZZ, CLASS_TO_NAME),
                    Functions.chain(Functions.getToClass(), CLASS_TO_NAME)
            ));

    MutableList<CompareBreak> relevantBreaks = sortedCompareBreaks.reject(breakIgnorePredicate);

    LOG.info("Found " + relevantBreaks.size() + " breaks");

    if (!relevantBreaks.isEmpty()) {
        throw new IllegalArgumentException(
                "Found some mismatches between your change alters (LEFT) and your baseline files (RIGHT). Please review:\n"
                        + relevantBreaks.makeString("\n"));
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:BaselineValidatorMain.java


示例20: normalizeWhiteSpaceFromStringOld

import org.eclipse.collections.api.list.MutableList; //导入依赖的package包/类
/**
 * See {@link #normalizeWhiteSpaceFromString(String)}. This is the "old" version of that method, with a slightly
 * harder-to-read implementation. I want to switch to {@link #normalizeWhiteSpaceFromString(String)} as it is
 * a more standard implementation and thus easier to vet.
 */
public static String normalizeWhiteSpaceFromStringOld(String content) {
    if (content == null) {
        return null;
    }
    String[] lines = content.split("\\r?\\n");

    MutableList<String> newContent = Lists.mutable.empty();
    for (String line : lines) {
        line = line.trim();
        if (!line.isEmpty()) {
            line = line.replaceAll("\\s+", " ");
            newContent.add(line.trim());
        }
    }

    return newContent.makeString(" ").trim();
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:23,代码来源:DAStringUtil.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CreateServiceInstanceAppBindingResponse类代码示例发布时间:2022-05-22
下一篇:
Java LaunchSound类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap