Currently, when Document class is initialized, it doesn't allow setting `initialCapacity` of internal LinkedHashMap so, that value gets set to 16 everytime. This doesn't work well if I already know number of entries going to be inserted / appended. If number of entries are are less than 16 then, it's kind of creating internal linked list table with bigger size or if entries are greater than 16, it's guaranteed to do `resize()`.
So, it would be nice if Document class exposes new constructor with initial capacity of internal LinkedHashMap.
/** * Creates an empty Document instance with custom intial capacity */ public Document(int initialCapacity) { documentAsMap = new LinkedHashMap<String, Object>(initialCapacity); }