Code example for SortedMap

Methods: headMap

0
    SortedMap<Long,byte[]> locks = new TreeMap<Long,byte[]>();
     
    @Override 
    synchronized public SortedMap<Long,byte[]> getEarlierEntries(long entry) {
      SortedMap<Long,byte[]> result = new TreeMap<Long,byte[]>();
      result.putAll(locks.headMap(entry + 1));
      return result;
    } 
     
    @Override 
    synchronized public void removeEntry(long entry) {
      synchronized (locks) {
        locks.remove(entry);
        locks.notifyAll();
      } 
    } 
     
    @Override 
    synchronized public long addEntry(byte[] data) {
      long result;
      synchronized (locks) {