mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
prune quarantine data on launch
I had hundreds of val==zero entries
This commit is contained in:
parent
e0b39bb9f4
commit
a1719f14b2
1 changed files with 16 additions and 2 deletions
|
@ -23,6 +23,7 @@ package org.eehouse.android.xw4;
|
|||
import android.content.Context;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@ -97,17 +98,29 @@ public class Quarantine {
|
|||
mCounts.put( rowid, 0 );
|
||||
}
|
||||
|
||||
synchronized void removeZeros()
|
||||
{
|
||||
for ( Iterator<Integer> iter = mCounts.values().iterator();
|
||||
iter.hasNext(); ) {
|
||||
if ( 0 == iter.next() ) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public String toString()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder().append("[");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
synchronized ( mCounts ) {
|
||||
sb.append("{len:").append(mCounts.size())
|
||||
.append(", data:[");
|
||||
for ( long rowid : mCounts.keySet() ) {
|
||||
int count = mCounts.get(rowid);
|
||||
sb.append( String.format("{%d: %d}", rowid, count ) );
|
||||
}
|
||||
}
|
||||
return sb.append("]").toString();
|
||||
return sb.append("]}").toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,6 +144,7 @@ public class Quarantine {
|
|||
data = new Data();
|
||||
} else {
|
||||
Log.d( TAG, "loading existing: %s", data );
|
||||
data.removeZeros();
|
||||
}
|
||||
sDataRef[0] = data;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue