use of it.unimi.dsi.fastutil.bytes.Byte2IntOpenHashMap in project symja_android_library by axkr.
the class BooleanColumn method summary.
@Override
public Table summary() {
Byte2IntMap counts = new Byte2IntOpenHashMap(3);
counts.put(BooleanColumnType.BYTE_FALSE, 0);
counts.put(BooleanColumnType.BYTE_TRUE, 0);
for (byte next : data) {
counts.put(next, counts.get(next) + 1);
}
Table table = Table.create(name());
StringColumn label = StringColumn.create("Value");
DoubleColumn countColumn = DoubleColumn.create("Count");
table.addColumns(label);
table.addColumns(countColumn);
for (Map.Entry<Byte, Integer> entry : counts.byte2IntEntrySet()) {
label.append(entry.getKey() == 1 ? "true" : "false");
countColumn.append(entry.getValue());
}
return table;
}
Aggregations