本文整理汇总了Java中org.eclipse.collections.impl.list.mutable.FastList类的典型用法代码示例。如果您正苦于以下问题:Java FastList类的具体用法?Java FastList怎么用?Java FastList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FastList类属于org.eclipse.collections.impl.list.mutable包,在下文中一共展示了FastList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: function0
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的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);
}
示例2: assertDirectoriesEqual
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
/**
* Primitive DB comparison method
* We just compare file names, not the subdirecory structure also
* (so this would fail if multiple subdirectories had the same file name)
*/
public static void assertDirectoriesEqual(File expected, File actual) {
MutableList<File> expectedFiles = FastList.newList(FileUtils.listFiles(expected, new WildcardFileFilter("*"),
DIR_FILE_FILTER));
expectedFiles = expectedFiles.sortThisBy(toRelativePath(expected));
MutableList<File> actualFiles = FastList.newList(FileUtils.listFiles(actual, new WildcardFileFilter("*"),
DIR_FILE_FILTER));
actualFiles = actualFiles.sortThisBy(toRelativePath(actual));
assertEquals(
String.format("Directories did not have same # of files:\nExpected: %1$s\nbut was: %2$s",
expectedFiles.makeString("\n"), actualFiles.makeString("\n")),
expectedFiles.size(), actualFiles.size());
for (int i = 0; i < expectedFiles.size(); i++) {
File expectedFile = expectedFiles.get(i);
File actualFile = actualFiles.get(i);
String expectedFilePath = getRelativePath(expectedFile, expected);
String actualFilePath = getRelativePath(actualFile, actual);
System.out.println("Comparing" + expectedFilePath + " vs " + actualFilePath);
assertEquals("File " + i + " [" + expectedFile + " vs " + actualFile
+ " does not match paths relative from their roots", expectedFilePath, actualFilePath);
FileAssert.assertEquals("Mismatch on file " + expectedFile.getAbsolutePath(), expectedFile, actualFile);
}
}
示例3: createTable
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
private void createTable(Connection conn, String tableName, boolean requireReorg) {
try {
executorJdbc.update(conn, "DROP TABLE " + tableName);
} catch (Exception ignore) {
// Ignoring the exception, as no clear "DROP TABLE IF EXISTS" is
// available in DB2
}
executorJdbc.update(conn, "create table " + tableName + " (a integer, b integer, c integer, d integer, e integer) ");
executorJdbc.update(conn, "insert into " + tableName + " (a) values (3)");
MutableList<String> expectedColumns;
if (requireReorg) {
executorJdbc.update(conn, "alter table " + tableName + " drop column b");
executorJdbc.update(conn, "alter table " + tableName + " drop column c");
executorJdbc.update(conn, "alter table " + tableName + " drop column d");
expectedColumns = Lists.mutable.with("A", "E");
} else {
expectedColumns = Lists.mutable.with("A", "B", "C", "D", "E");
}
// Assert the columns which are available in table A
String columnListSql = "select colname from syscat.COLUMNS where tabschema = '" + physicalSchema.getPhysicalName() + "' AND tabname = '"
+ tableName + "'";
List<String> columnsInTableA = this.db2JdbcTemplate.query(conn, columnListSql,
new ColumnListHandler<String>());
assertEquals(expectedColumns, FastList.newList(columnsInTableA));
}
示例4: getRowKeys
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
private List<Object> getRowKeys(ResultTable results, int drilldownLimit)
{
List<Object> rowKeys = FastList.newList();
List<List<ResultCell>> table = results.getVerifiedRows();
int rowIndex = 1;
while (rowIndex < table.size() && rowKeys.size() < drilldownLimit)
{
List<ResultCell> values = table.get(rowIndex);
int passedCount = Iterate.count(values, ResultCell.IS_PASSED_CELL);
int failedCount = Iterate.count(values, ResultCell.IS_FAILED_CELL);
if (passedCount == 0 || failedCount > 0)
{
ResultCell cell = Iterate.getLast(values);
rowKeys.add(cell.getActual() == null ? cell.getExpected() : cell.getActual());
}
rowIndex++;
}
return rowKeys;
}
示例5: collectReverseMatchingRows
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
private static void collectReverseMatchingRows(MutableList<IndexMap> columnIndices, List<List<ResultCell>> reverseHappyPathResults, VerifiableTable actualData, VerifiableTable expectedData, ColumnComparators columnComparators, int firstUnMatchedIndex)
{
int actualIndex = actualData.getRowCount() - 1;
int expectedIndex = expectedData.getRowCount() - 1;
int minActualIndex = firstUnMatchedIndex + 1;
int minExpectedIndex = firstUnMatchedIndex + 1;
while (expectedIndex >= minExpectedIndex && actualIndex >= minActualIndex)
{
MutableList<ResultCell> row = FastList.newList(columnIndices.size());
if (!checkRowMatches(columnIndices, reverseHappyPathResults, actualData, expectedData, columnComparators, actualIndex, expectedIndex, row))
{
return;
}
expectedIndex--;
actualIndex--;
}
}
示例6: verifyTables
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
public Map<String, ResultTable> verifyTables(Map<String, ? extends VerifiableTable> expectedResults, Map<String, ? extends VerifiableTable> actualResults)
{
Map<String, ResultTable> results = new LinkedHashMap<>();
List<String> allTableNames = FastList.newList(expectedResults.keySet());
for (String actualTable : actualResults.keySet())
{
if (!expectedResults.containsKey(actualTable))
{
allTableNames.add(actualTable);
}
}
for (String tableName : allTableNames)
{
verifyTable(tableName, actualResults, expectedResults, results);
}
return results;
}
示例7: getStackLineCount
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
private static List<Pair<String, List<String>>> getStackLineCount(String string) throws IOException
{
List<Pair<String, List<String>>> stackTraces = FastList.newList();
Pair<String, List<String>> stackTrace = null;
BufferedReader reader = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(string.getBytes())));
String line = reader.readLine();
while (line != null)
{
if (line.startsWith(" "))
{
stackTrace.getTwo().add(line);
}
else
{
stackTrace = Tuples.<String, List<String>>pair(line, FastList.<String>newList());
stackTraces.add(stackTrace);
}
line = reader.readLine();
}
return stackTraces;
}
示例8: createInMemoryDefault
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
public static SqlTranslatorConfigHelper createInMemoryDefault() {
SqlTranslatorConfigHelper configHelper = new SqlTranslatorConfigHelper();
configHelper.setNameMapper(new DefaultSqlTranslatorNameMapper());
configHelper.setColumnSqlTranslators(FastList.<ColumnSqlTranslator>newListWith());
configHelper.setPostColumnSqlTranslators(FastList.<PostColumnSqlTranslator>newListWith());
configHelper.setPostParsedSqlTranslators(FastList.<PostParsedSqlTranslator>newListWith(new ForeignKeyNameRemovalSqlTranslator()));
configHelper.setPreParsedSqlTranslators(FastList.<PreParsedSqlTranslator>newListWith(new RemoveWithPreParsedSqlTranslator()));
configHelper.setUnparsedSqlTranslators(FastList.<UnparsedSqlTranslator>newListWith(new DefaultUnparsedSqlTranslator()));
return configHelper;
}
示例9: DelimitedStreamDataSource
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
public DelimitedStreamDataSource(String name, Reader reader, List<String> fields, String delimiter) {
super(name, reader);
this.delimiter = delimiter;
this.fields = FastList.newList(fields);
if (delimiter.equals("|")) {
LOG.warn("The delimiter is a regex, are you sure you want to use \"|\" instead of \"\\|\"?");
}
}
示例10: readLines
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
public static MutableList<String> readLines(File file) {
try {
return FastList.newList(FileUtils.readLines(file));
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
}
示例11: getColumns
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
private List<String> getColumns(VerifiableTable table)
{
List<String> cols = FastList.newList(table.getColumnCount());
for (int i = 0; i < table.getColumnCount(); i++)
{
cols.add(table.getColumnName(i));
}
return cols;
}
示例12: collectMatchingRows
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
private static void collectMatchingRows(MutableList<IndexMap> columnIndices, List<List<ResultCell>> results, VerifiableTable actualData, VerifiableTable expectedData, ColumnComparators columnComparators)
{
int minRowCount = Math.min(actualData.getRowCount(), expectedData.getRowCount());
for (int rowIndex = 0; rowIndex < minRowCount; rowIndex++)
{
MutableList<ResultCell> row = FastList.newList(columnIndices.size());
if (!checkRowMatches(columnIndices, results, actualData, expectedData, columnComparators, rowIndex, rowIndex, row))
{
return;
}
}
}
示例13: getHeadings
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
private static List<String> getHeadings(VerifiableTable table, CellComparator comparator)
{
FastList<String> headings = FastList.newList();
for (int i = 0; i < table.getColumnCount(); i++)
{
headings.add(comparator.getFormatter().format(table.getColumnName(i)));
}
return headings;
}
示例14: getKeyColumnIndexMaps
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
private List<IndexMap> getKeyColumnIndexMaps(List<IndexMap> columnIndices)
{
List<IndexMap> keyColumns = FastList.newList(columnIndices.size());
for (IndexMap columnIndexMap : columnIndices)
{
if (columnIndexMap.isMatched() && this.actualData.isKeyColumn(columnIndexMap.getActualIndex()))
{
keyColumns.add(columnIndexMap);
}
}
return keyColumns;
}
示例15: getAll
import org.eclipse.collections.impl.list.mutable.FastList; //导入依赖的package包/类
public MutableList<IndexMap> getAll()
{
Set<IndexMap> all = new TreeSet<>();
all.addAll(this.matched);
all.addAll(this.surplus);
all.addAll(this.missing);
return FastList.newList(all);
}