Code example for TreeMap

0
    private Map<Object,Map<String,Object>> rowMap;
    private int nextId;
     
    MemoryTable(String tableName) {
        this.tableName = tableName;
        rowMap = new TreeMap<Object,Map<String,Object>>();
        nextId = 0;
    } 
     
    String getTableName() {
        return tableName;
    } 
     
    Collection<Map<String,Object>> getAllRows() {
        return rowMap.values();
    } 
     
    Map<String,Object> getRow(Object key) {
        Map<String,Object> row = rowMap.get(key);
        return row;
    }