code: @SuppressWarnings("unchecked")
      public void loopMap(final Object x, final MapIterCallback<K, V> callback) {
          if (x == null) {
              return;
          }
  
          if (x instanceof Collection) {
              throw new IllegalArgumentException("call loop instead");
          }
  
          if (x instanceof HashMap<?, ?>) {
              if (((HashMap) x).isEmpty()) {
                  return;
              }
  
              final HashMap<?, ?> hm = (HashMap<?, ?>) x;
              for (final Entry<?, ?> e : hm.entrySet()) {
                  callback.eval((K) e.getKey(), (V) e.getValue());
              }
              return;
          }
          if (x instanceof Map) {
              final Map<K, V> m = (Map<K, V>) x;
              for (final Entry<K, V> entry : m.entrySet()) {
                  callback.eval(entry.getKey(), entry.getValue());
              }
              return;
          }
          if (x instanceof BSONObject) {
              final BSONObject m = (BSONObject) x;
              for (final String k : m.keySet()) {
                  callback.eval((K) k, (V) m.get(k));
              }
          }
  
      }
docs: Process a Map
  
  @param x        the object to process
  @param callback the callback