-
Notifications
You must be signed in to change notification settings - Fork 4
PrintableDict
Jas edited this page Mar 9, 2017
·
2 revisions
This object extends the standard Dict
object but adds the following support:
-
toString
: Prints the dictionary contents correctly, similar to a HashMap -
getSize
: Returns the number of entries in the dictionary, similar to kdb+count
As this object is a sub-class of Dict
, it can be used anywhere that Dict
would normally be used. For example, KdbDict.convertToDict
returns a PrintableDict
.
The standard Dict
constructor is overridden and can be used:
public Dict newDict() {
Object[] keys = { 1, 2, 3 };
Object[] vals = { "abc", "def", "ghi" };
return new PrintableDict(keys, vals);
}
There is also a new constructor PrintableDict(Dict)
which converts a standard Dict
:
public Dict newPrintableFromDict() {
Object[] keys = { 1, 2, 3 };
Object[] vals = { "abc", "def", "ghi" };
return new PrintableDict(new Dict(keys, vals));
}
Copyright (C) Sport Trades Ltd 2017 - 2020, John Keys and Jaskirat Rajasansir 2020 - 2021