How to sort items for faster insertion in the MapDB BTree? <p>so I have a list of around 20 million key value pairs, and I'm storing the data in several MapDB's differently to see how it affects my programs performance, and for experiment sake.</p> <p>The thing is, it takes quite a lot of time to insert (in random order) 20 million key-value pairs into a mapdb. So, I would like to sort the list of key-value pairs I have so I can insert them faster, and thus build databases faster out of them.</p> <p>So, how would I go about this?</p> <p>I'd like to learn how to do this for MapDB's BTreeSet and BTreeMap, or, MapDBs that use single key-value pairs and MapDBs that have multiple values for a single key.</p> <p>EDIT: I forgot to mention, the key-value pairs are String objects.</p>