本文整理汇总了Java中com.google.common.collect.ArrayTable.get方法的典型用法代码示例。如果您正苦于以下问题:Java ArrayTable.get方法的具体用法?Java ArrayTable.get怎么用?Java ArrayTable.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ArrayTable
的用法示例。
在下文中一共展示了ArrayTable.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadFromDb
import com.google.common.collect.ArrayTable; //导入方法依赖的package包/类
private static void loadFromDb(ArrayTable<Integer, Character, List<Person>> personsTable) throws IOException {
long start = System.currentTimeMillis();
File dbFile = new File(Config.DB_FILE_NAME);
LineIterator it = FileUtils.lineIterator(dbFile, "UTF-8");
while(it.hasNext()) {
String line = it.next();
Person person = parseStringTokenizer(line);
char fc = person.name.charAt(0);
List<Person> persons = personsTable.get(person.age, fc);
if(persons == null) {
persons = new ArrayList<>();
personsTable.put(person.age, person.name.charAt(0), persons);
}
persons.add(person);
}
System.out.println("load data elapsed time : " + (System.currentTimeMillis() - start));
}
示例2: histoDataAsMLDouble
import com.google.common.collect.ArrayTable; //导入方法依赖的package包/类
private MLDouble histoDataAsMLDouble(String name, ArrayTable<Integer, String, Float> histoData) {
int rowsSize = histoData.rowKeySet().size();
int colsSize = histoData.columnKeySet().size();
MLDouble mlDouble = new MLDouble(name, new int[] {rowsSize, colsSize});
int i = 0;
for (Integer rowKey : histoData.rowKeyList()) {
int j = 0;
for (String colkey : histoData.columnKeyList()) {
Float v = histoData.get(rowKey, colkey);
mlDouble.set(new Double(v), i, j);
j++;
}
i++;
}
return mlDouble;
}
示例3: histoDataAsDoubleMatrixNew
import com.google.common.collect.ArrayTable; //导入方法依赖的package包/类
public static double[][] histoDataAsDoubleMatrixNew(ArrayTable<Integer, String, Float> hdTable) {
int rowsSize = hdTable.rowKeySet().size();
int colsSize = hdTable.columnKeySet().size();
double[][] matFinal = new double[rowsSize][colsSize];
int i = 0;
for (Integer rowKey : hdTable.rowKeyList()) {
int j = 0;
for (String colkey : hdTable.columnKeyList()) {
Float v = hdTable.get(rowKey, colkey);
matFinal[i][j] = getCleanFloat(v);
j = j + 1;
}
i = i + 1;
}
return matFinal;
}
示例4: histoDataAsDoubleMatrix
import com.google.common.collect.ArrayTable; //导入方法依赖的package包/类
public static double[][] histoDataAsDoubleMatrix(ArrayTable<Integer, String, Float> hdTable) {
int rowsSize = hdTable.rowKeySet().size();
int colsSize = hdTable.columnKeySet().size();
double[][] matFinal = new double[rowsSize][colsSize];
for (int i = 0; i < rowsSize; i++) {
for (int j = 0; j < colsSize; j++) {
Float v = hdTable.get(i, j);
matFinal[i][j] = getCleanFloat(v);
}
}
return matFinal;
}