本文整理汇总了Java中org.eclipse.collections.api.list.MutableList类的典型用法代码示例。如果您正苦于以下问题:Java MutableList类的具体用法?Java MutableList怎么用?Java MutableList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MutableList类属于org.eclipse.collections.api.list包,在下文中一共展示了MutableList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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");
}
示例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);
}
示例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("\\", "/");
}
示例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;
}
}
});
}
示例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));
}
}
}
示例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();
}
示例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
);
}
});
}
示例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;
}
示例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));
}
示例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());
}
}
示例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"));
}
}
示例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;
}
示例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);
}
}