本文整理汇总了Java中gnu.trove.iterator.TLongIntIterator类的典型用法代码示例。如果您正苦于以下问题:Java TLongIntIterator类的具体用法?Java TLongIntIterator怎么用?Java TLongIntIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TLongIntIterator类属于gnu.trove.iterator包,在下文中一共展示了TLongIntIterator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Alphabet
import gnu.trove.iterator.TLongIntIterator; //导入依赖的package包/类
public Alphabet(Alphabet a)
{
numEntries = a.numEntries;
map = new TLongIntHashMap(numEntries);
for (TLongIntIterator iter = a.map.iterator(); iter.hasNext();) {
iter.advance();
map.put(iter.key(), iter.value());
}
}
示例2: saveLongIntDictionary
import gnu.trove.iterator.TLongIntIterator; //导入依赖的package包/类
public static void saveLongIntDictionary(LongIntDict dict, String fileName) throws IOException {
long time = System.currentTimeMillis();
TLongIntIterator iter = dict.getIterator();
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(fileName))));
String newLine = "";
while (iter.hasNext()) {
iter.advance();
newLine = "" + iter.key() + "\t" + iter.value();
bw.write(newLine);
bw.newLine();
}
bw.flush();
bw.close();
logger.info(((System.currentTimeMillis() - time) / 1000d) + "s");
}
示例3: getInverted
import gnu.trove.iterator.TLongIntIterator; //导入依赖的package包/类
public synchronized TIntLongMap getInverted(){
TIntLongMap inverted=TCollections.synchronizedMap(new TIntLongHashMap());
TLongIntIterator iter = this.getIterator();
while (iter.hasNext()) {
iter.advance();
inverted.put(iter.value(), iter.key());
}
return inverted;
}
示例4: getIterator
import gnu.trove.iterator.TLongIntIterator; //导入依赖的package包/类
public TLongIntIterator getIterator(){
return this.map.iterator();
}
示例5: iterator
import gnu.trove.iterator.TLongIntIterator; //导入依赖的package包/类
public TLongIntIterator iterator() {
return container.iterator();
}
示例6: toString
import gnu.trove.iterator.TLongIntIterator; //导入依赖的package包/类
public String toString() {
StringBuilder tStr = new StringBuilder();
// tStr.append("- buckets\n");
// for ( int i=0; i<tables.length; i++ ) {
//
// tStr.append(gs[i]);
//
// int sum = 0;
// for ( int j=0; j<tables[i].length; j++ ) {
//
// if (tables[i][j]==null) continue;
// tStr.append(tables[i][j].size() + " ");
// sum+=tables[i][j].size();
//
//
// }
// tStr.append("\t[" + sum + "]\n");
//
//
// }
tStr.append( "- nBuckets:\t" );
for ( int i=0; i<ls.length; i++ ) {
if ( i>0 ) tStr.append(", ");
tStr.append( ls[i].getNumberOfBuckets() );
}
tStr.append("\n");
long nNotNulls = 0;
int maxN = -1;
int maxID1 = -1;
long maxID2 = -1;
long sum =0;
for ( int i1=0; i1<ls.length; i1++ ) {
//for ( int i2=0; i2<ls[i1].nh; i2++ ) {
for ( TLongIntIterator it = ls[i1].bSize.iterator(); it.hasNext(); ) {
it.advance();
int csize = it.value();
if ( csize > 0 ) {
nNotNulls += 1;
int size = csize;
sum += size;
if ( size > maxN ) {
maxN=size;
maxID1=i1;
maxID2=it.key();
}
}
}
}
tStr.append("- nObjs\t" + (sum / (double) ls.length) + "\n");
tStr.append("- notNullBuckets\t" + nNotNulls + "\n");
tStr.append("- avgNotNullBucketSize\t" + sum/(double) nNotNulls + "\n");
tStr.append("- biggestBucket\t" + maxN + "\t" + "(" + maxID1 + "," + maxID2 +")");
// try {
// tStr.append("- sizeInBytes\t" + this.getDataSizeInBytes() + "\n");
// tStr.append("- nObjects\t" + this.getNObjs() + "\n");
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
return tStr.toString();
}