@ Override public Map < byte [ ] , byte [ ] > loadAllByKeys ( Collection < byte [ ] > keys ) { if ( keys == null || keys . size ( ) == 0 ) { return Collections . EMPTY_MAP ; } Map < byte [ ] , byte [ ] > results = new LinkedHashMap <> ( keys . size ( ) ) ; DBIterator iterator = null ; try { iterator = database . iterator ( ) ; iterator . seek ( keys . iterator ( ) . next ( ) ) ; while ( iterator . hasNext ( ) ) { final Map . Entry < byte [ ] , byte [ ] > next = iterator . next ( ) ; results . put ( next . getKey ( ) , next . getValue ( ) ) ; } } finally { try { if ( iterator != null ) { iterator . close ( ) ; } } catch ( IOException e ) { Exceptions . handle ( e ) ; } } return results ; }
Keys are expected to be sorted