We already know that Hive supports unsigned integer keys. You can use auto increment keys if you like. This is very useful for storing and accessing multiple objects. You can use a Box like a list.
var friends = Hive.box('friends');friends.add('Lisa'); // index 0, key 0friends.add('Dave'); // index 1, key 1friends.put(123, 'Marco'); // index 2, key 123print(friends.values); // Lisa, Dave, Marco
There are also
deleteAt() methods to access or change values by their index.
It is important to understand the difference of integer keys and indices.
Both of these operations do the same thing. They replace
putAt() uses the index (in this case
put() uses the key (in this case
This also works with String keys.