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


Java Lists类代码示例

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


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

示例1: testSortWithFk

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
@Test
public void testSortWithFk() throws Exception {
    final ExecuteChangeCommand aTab1 = newIncrementalCommand(tableChangeType(), "ATab", "1", Sets.immutable.<String>of(), 1);
    final ExecuteChangeCommand aTab2 = newIncrementalCommand(tableChangeType(), "ATab", "2", Sets.immutable.<String>of(), 2);
    final ExecuteChangeCommand aTab3 = newIncrementalCommand(tableChangeType(), "ATab", "3", Sets.immutable.<String>of(), 3);
    final ExecuteChangeCommand bTab1 = newIncrementalCommand(tableChangeType(), "BTab", "1", Sets.immutable.<String>of(), 1);
    final ExecuteChangeCommand bTab2 = newIncrementalCommand(tableChangeType(), "BTab", "2", Sets.immutable.<String>of("ATab"), 2);
    final ExecuteChangeCommand bTab3 = newIncrementalCommand(tableChangeType(), "BTab", "3", Sets.immutable.<String>of(), 3);
    final ListIterable<ExecuteChangeCommand> sortedCommands = sorter.sort(Lists.mutable.of(
            aTab1
            , aTab2
            , aTab3
            , bTab1
            , bTab2
            , bTab3
    ), false);

    // assert basic order
    assertThat("aTab changes should be in order", sortedCommands.indexOf(aTab1), Matchers.lessThan(sortedCommands.indexOf(aTab2)));
    assertThat("aTab changes should be in order", sortedCommands.indexOf(aTab2), Matchers.lessThan(sortedCommands.indexOf(aTab3)));
    assertThat("bTab changes should be in order", sortedCommands.indexOf(bTab1), Matchers.lessThan(sortedCommands.indexOf(bTab2)));
    assertThat("bTab changes should be in order", sortedCommands.indexOf(bTab2), Matchers.lessThan(sortedCommands.indexOf(bTab3)));

    // assert cross-object dependency
    assertThat("assert bTab change depending on aTab comes after tabA", sortedCommands.indexOf(aTab1), Matchers.lessThan(sortedCommands.indexOf(bTab2)));
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:27,代码来源:ChangeCommandSorterImplTest.java

示例2: function

import org.eclipse.collections.impl.factory.Lists; //导入依赖的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

示例3: function0

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
@Test
public void function0()
{
    // TODO - Convert this anonymous inner class to a lambda and then to a constructor reference
    Function0<List<String>> supplier = new Function0<List<String>>()
    {
        @Override
        public List<String> value()
        {
            return FastList.newList();
        }
    };
    Assert.assertEquals(Lists.mutable.empty(), supplier.get());
    Assert.assertNotSame(supplier.get(), supplier.get());
    List<String> list = Stream.of("1", "2", "3").collect(Collectors.toCollection(supplier));
    Assert.assertEquals(Lists.mutable.with("1", "2", "3"), list);
}
 
开发者ID:BNYMellon,项目名称:CodeKatas,代码行数:18,代码来源:EclipseCollectionsFunctionalInterfaceTest.java

示例4: getAdditionalTranslators

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
@Override
public ImmutableList<PrepareDbChange> getAdditionalTranslators() {
    SqlTranslatorConfigHelper configHelper = SqlTranslatorConfigHelper.createInMemoryDefault();
    configHelper.setNameMapper(new AseSqlTranslatorNameMapper());
    configHelper.getPostColumnSqlTranslators()
            .with(new AseToH2SqlTranslator());
    configHelper.getPostParsedSqlTranslators()
            .with(new AseToInMemorySqlTranslator())
            .with(new DateFormatterPostParsedSqlTranslator(AseToInMemorySqlTranslator.ACCEPTED_DATE_FORMATS))
            .with(new AseToH2SqlTranslator());;
    configHelper.getUnparsedSqlTranslators()
            .with(new AseToInMemorySqlTranslator())
            .with(new AseToH2DomainSqlTranslator())
            .with(new AseRenameTranslator())
    ;

    return Lists.immutable.<PrepareDbChange>with(new InMemoryTranslator(configHelper));
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:19,代码来源:AseToH2TranslationDialect.java

示例5: testBaselineException

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
@Test
public void testBaselineException() {
    // In this use case, srcB is the baseline change w/ ch1 ch2 ch3 marked. However, we only see ch1 and ch2 deployed, so we throw an exception

    Change dep1 = new ChangeIncremental(tableChangeType(), "schema", "tabB", "ch1", 0, "chng1", CONTENT);
    Change dep2 = new ChangeIncremental(tableChangeType(), "schema", "tabB", "ch2", 0, "chng1", CONTENT);
    // hiding dep3 as to show the exception use case
    //Change dep3 = new ChangeIncremental(tableChangeType(), "schema", "tabB", "ch3", 0, "chng1", CONTENT);
    Change srcB = new ChangeIncremental(tableChangeType(), "schema", "tabB", "bas1", 0, "chng1", CONTENT)
            .withBaselines(Lists.mutable.with("ch1", "ch2", "ch3"));
    Change src4 = new ChangeIncremental(tableChangeType(), "schema", "tabB", "ch4", 1, "chng1", CONTENT);

    ListIterable<ChangeCommand> changeset = cmdCalc.calculateCommands(tableChangeType(), Lists.mutable.of(
            new ChangePair(srcB, null)
            , new ChangePair(src4, null)
            , new ChangePair(null, dep1)
            , new ChangePair(null, dep2)
    ), unusedChangesArg, false, false);

    assertEquals(2, changeset.size());
    Verify.assertAnySatisfy(changeset, assertValue(DeployChangeCommand.class, src4));
    Predicate<ChangeCommand> baselineWarningPredicate = assertValue(IncompleteBaselineWarning.class, srcB);
    Verify.assertAnySatisfy(changeset, baselineWarningPredicate);
    IncompleteBaselineWarning baselineWarning = (IncompleteBaselineWarning) changeset.detect(baselineWarningPredicate);
    assertEquals(Sets.mutable.with("ch3"), baselineWarning.getNonDeployedChanges());
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:27,代码来源:IncrementalChangeTypeCommandCalculatorTest.java

示例6: getAdditionalTranslators

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
@Override
public ImmutableList<PrepareDbChange> getAdditionalTranslators() {
    SqlTranslatorConfigHelper configHelper = SqlTranslatorConfigHelper.createInMemoryDefault();
    configHelper.setNameMapper(new MsSqlSqlTranslatorNameMapper());
    configHelper.getPostColumnSqlTranslators()
            .with(new MsSqlToH2SqlTranslator());
    configHelper.getPostParsedSqlTranslators()
            .with(new MsSqlToInMemorySqlTranslator())
            .with(new DateFormatterPostParsedSqlTranslator(MsSqlToInMemorySqlTranslator.ACCEPTED_DATE_FORMATS))
            .with(new MsSqlToH2SqlTranslator());
    ;
    configHelper.getUnparsedSqlTranslators()
            .with(new MsSqlToInMemorySqlTranslator())
            .with(new MsSqlToH2DomainSqlTranslator());

    return Lists.immutable.<PrepareDbChange>with(new InMemoryTranslator(configHelper));
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:18,代码来源:MsSqlToH2TranslationDialect.java

示例7: getRevengPatterns

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
static ImmutableList<RevengPattern> getRevengPatterns() {
    String schemaNameSubPattern = getSchemaObjectPattern("\\[", "\\]");
    NamePatternType namePatternType = NamePatternType.TWO;

    return Lists.immutable.with(
            new AbstractDdlReveng.RevengPattern(ChangeType.USERTYPE_STR, namePatternType, "(?i)create\\s+type\\s+" + schemaNameSubPattern + "\\s+"),
            new AbstractDdlReveng.RevengPattern(ChangeType.DEFAULT_STR, namePatternType, "(?i)create\\s+default\\s+" + schemaNameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.SEQUENCE_STR, namePatternType, "(?i)create\\s+seq(uence)?\\s+" + schemaNameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)create\\s+table\\s+" + schemaNameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)alter\\s+table\\s+" + schemaNameSubPattern + "\\s+add\\s+constraint\\s+" + schemaNameSubPattern + "\\s+foreign\\s+key", 1, 2, "FK"),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)alter\\s+table\\s+" + schemaNameSubPattern + "\\s+add\\s+constraint\\s+" + schemaNameSubPattern, 1, 2, null),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)alter\\s+table\\s+" + schemaNameSubPattern + "\\s+"),
            new AbstractDdlReveng.RevengPattern(ChangeType.TABLE_STR, namePatternType, "(?i)create\\s+(?:(?:unique)|(?:nonclustered)\\s+)?(?:\\w+\\s+)?index\\s+" + schemaNameSubPattern + "\\s+on\\s+" + schemaNameSubPattern, 2, 1, "INDEX"),
            new AbstractDdlReveng.RevengPattern(ChangeType.FUNCTION_STR, namePatternType, "(?i)create\\s+func(tion)?\\s+" + schemaNameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.VIEW_STR, namePatternType, "(?i)create\\s+view\\s+" + schemaNameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.SP_STR, namePatternType, "(?i)create\\s+proc(?:edure)?\\s+" + schemaNameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.TRIGGER_STR, namePatternType, "(?i)create\\s+trigger\\s+" + schemaNameSubPattern + "\\s+on\\s+" + schemaNameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.RULE_STR, namePatternType, "(?i)create\\s+rule\\s+" + schemaNameSubPattern),
            new AbstractDdlReveng.RevengPattern(ChangeType.USERTYPE_STR, namePatternType, "(?i)^(exec\\s+)?sp_addtype\\s+'(\\w+)'")
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:22,代码来源:MsSqlReveng.java

示例8: testCycleValidation

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
@Test
public void testCycleValidation() {
    this.enricher = new GraphEnricherImpl(Functions.getStringPassThru());

    SortableDependencyGroup cyc1Obj1 = newChange(schema1, type1, "cyc1Obj1", Sets.immutable.with(schema2 + ".cyc1Obj3"));
    SortableDependencyGroup cyc1Obj2 = newChange(schema1, type2, "cyc1Obj2", Sets.immutable.with("cyc1Obj1"));
    SortableDependencyGroup cyc1Obj3 = newChange(schema2, type1, "cyc1Obj3", Sets.immutable.with(schema1 + ".cyc1Obj2", schema2 + ".cyc1Obj4", schema2 + ".notcyc1ObjB"));
    SortableDependencyGroup cyc1Obj4 = newChange(schema2, type1, "cyc1Obj4", Sets.immutable.with(schema2 + ".cyc1Obj5"));
    SortableDependencyGroup cyc1Obj5 = newChange(schema2, type1, "cyc1Obj5", Sets.immutable.with(schema2 + ".cyc1Obj3"));
    SortableDependencyGroup notcyc1ObjA = newChange(schema2, type1, "notcyc1ObjA", Sets.immutable.with(schema2 + ".cyc1Obj3"));  // inbound edge to cycle, but not in it
    SortableDependencyGroup notcyc1ObjB = newChange(schema2, type1, "notcyc1ObjB", Sets.immutable.<String>with());  // outbound edge from cycle, but not in it
    SortableDependencyGroup cyc2Obj1 = newChange(schema2, type1, "cyc2Obj1", Sets.immutable.with(schema2 + ".cyc2Obj2"));
    SortableDependencyGroup cyc2Obj2 = newChange(schema2, type1, "cyc2Obj2", Sets.immutable.with(schema2 + ".cyc2Obj3"));
    SortableDependencyGroup cyc2Obj3 = newChange(schema2, type1, "cyc2Obj3", Sets.immutable.with(schema2 + ".cyc2Obj1"));
    SortableDependencyGroup loneObj1 = newChange(schema2, type1, "loneObj1", Sets.immutable.<String>with());

    try {
        enricher.createDependencyGraph(Lists.mutable.with(
                cyc1Obj1, cyc1Obj2, cyc1Obj3, cyc1Obj4, cyc1Obj5, notcyc1ObjA, notcyc1ObjB, cyc2Obj1, cyc2Obj2, cyc2Obj3, loneObj1), false);
        fail("Expecting an exception here due to a cycle exception, but a cycle exception was not found");
    } catch (IllegalArgumentException exc) {
        exc.printStackTrace();
        assertThat(exc.getMessage(), containsString("Found cycles"));
    }
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:26,代码来源:GraphEnricherImplTest.java

示例9: valueOf

import org.eclipse.collections.impl.factory.Lists; //导入依赖的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

示例10: copyFieldsFrom

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
public void copyFieldsFrom(Environment<T> env) {
    this.name = env.name;
    this.platform = env.platform;
    this.cleanBuildAllowed = env.cleanBuildAllowed;
    this.tokens = env.tokens;
    this.defaultUserId = env.defaultUserId;
    this.defaultPassword = env.defaultPassword;
    this.appContextBuilderClass = env.appContextBuilderClass;
    this.coreSourcePath = env.coreSourcePath;
    this.additionalSourceDirs = Lists.mutable.withAll(env.additionalSourceDirs);
    this.sourceDirs = env.sourceDirs;
    this.dbSchemaPrefix = env.dbSchemaPrefix;
    this.dbSchemaSuffix = env.dbSchemaSuffix;
    this.allSchemas = env.allSchemas;
    this.schemaNameOverrides = env.schemaNameOverrides;
    this.rollbackDetectionEnabled = env.rollbackDetectionEnabled;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:18,代码来源:Environment.java

示例11: newCommand

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
private ExecuteChangeCommand newCommand(ChangeType changeType, String objectName, String changeName, ImmutableSet<String> dependencies) {
    Change change = mock(Change.class);
    when(change.getObjectKey()).thenReturn(new ObjectKey("schema", changeType, objectName));
    when(change.getSchema()).thenReturn("schema");
    when(change.getChangeType()).thenReturn(changeType);
    when(change.getObjectName()).thenReturn(objectName);
    when(change.getChangeName()).thenReturn(changeName);
    when(change.getCodeDependencies()).thenReturn(dependencies.collectWith(CodeDependency.CREATE_WITH_TYPE, CodeDependencyType.EXPLICIT));
    change.getContentForDependencyCalculation();


    ExecuteChangeCommand command = mock(ExecuteChangeCommand.class);
    when(command.isDrop()).thenReturn(false);
    when(command.getChanges()).thenReturn(Lists.immutable.of(change));

    return command;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:18,代码来源:ChangeCommandSorterImplTest.java

示例12: getUniqueIndexColumnNames

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
private ImmutableList<String> getUniqueIndexColumnNames(Change artifact, DaTable table) {
    String keySpecified = artifact.getMetadataAttribute(TextMarkupDocumentReader.ATTR_PRIMARY_KEYS);
    boolean overrideKeys = keySpecified != null;
    ImmutableList<String> keyFields;
    DaIndex uniqueKey = this.getUniqueKey(table);
    if(overrideKeys && uniqueKey == null){
        keyFields = Lists.immutable.with(artifact.getMetadataAttribute(TextMarkupDocumentReader.ATTR_PRIMARY_KEYS).split(","));
    }
    else if(overrideKeys && uniqueKey != null){
        throw new IllegalStateException("Cannot specify primary key and override tag on table " + table.getName()
                + " to support CSV-based static data support");
    }
    else{
        if(uniqueKey == null){
            throw new IllegalStateException("Require a primary key or unique index on table " + table.getName()
                    + " to support CSV-based static data support");
        }
        keyFields = uniqueKey.getColumns().collect(DaNamedObject.TO_NAME)
                .collect(this.dbPlatform.convertDbObjectName());
    }
    return keyFields;
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:23,代码来源:CsvStaticDataDeployer.java

示例13: executeDeletes

import org.eclipse.collections.impl.factory.Lists; //导入依赖的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

示例14: getColumnsOrderedBySelectivity

import org.eclipse.collections.impl.factory.Lists; //导入依赖的package包/类
private MutableList<IndexMap> getColumnsOrderedBySelectivity(MutableList<UnmatchedIndexMap> allMissingRows, MutableList<UnmatchedIndexMap> allSurplusRows, MutableList<IndexMap> columnIndices)
{
    LOGGER.info("Calculating column selectivity");
    MutableList<Pair<IndexMap, Integer>> columnSelectivities = Lists.mutable.of();
    for (IndexMap column : columnIndices)
    {
        CellComparator expectedComparator = this.columnComparators.getComparator(expectedData.getColumnName(column.getExpectedIndex()));
        Set<String> expectedValues = getColumnValues(allMissingRows, Functions.chain(expectedValueFunction(column), expectedComparator.getFormatter()));
        CellComparator actualComparator = this.columnComparators.getComparator(actualData.getColumnName(column.getActualIndex()));
        Set<String> actualValues = getColumnValues(allSurplusRows, Functions.chain(actualValueFunction(column), actualComparator.getFormatter()));
        actualValues.retainAll(expectedValues);
        int selectivity = actualValues.size();
        if (selectivity > 0)
        {
            columnSelectivities.add(Tuples.pair(column, Integer.valueOf(selectivity)));
        }
    }
    return columnSelectivities
            .sortThis(Comparators.reverse(Comparators.byFunction(Functions.<Integer>secondOfPair())))
            .collect(Functions.<IndexMap>firstOfPair());
}
 
开发者ID:goldmansachs,项目名称:tablasco,代码行数:22,代码来源:AdaptivePartialMatcher.java

示例15: handleChanges

import org.eclipse.collections.impl.factory.Lists; //导入依赖的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


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