code: public static Map<String, String> queryToMap( ADb db, String sql, Map<String, String> optionalType ) throws Exception {
          Map<String, String> map = optionalType;
          if (map == null) {
              map = new HashMap<>();
          }
          Map<String, String> _map = map;
          return db.execOnConnection(connection -> {
              try (IHMStatement stmt = connection.createStatement(); IHMResultSet rs = stmt.executeQuery(sql)) {
                  while( rs.next() ) {
                      String key = rs.getObject(1).toString();
                      String value = rs.getObject(2).toString();
                      _map.put(key, value);
                  }
                  return _map;
              }
          });
      }
docs: Quick method to convert a query to a map.
  
  @param db the db to use.
  @param sql the query to run. It has to have at least 2 parameters. The first will be used as key, the second as value.
  @param optionalType can be null. Optional parameter in case one needs a {@link TreeMap} or something the like.
  @return the map of values from the query.
  @throws Exception