public static void createPersistentDomain(@NotNull String domainName, @Nullable Map<String, Object> values) {
    final Foundation.NSAutoreleasePool pool = new Foundation.NSAutoreleasePool();
    try {
      final ID defaults = Foundation.invoke("NSUserDefaults", "standardUserDefaults");
      if (defaults.equals(ID.NIL))
        return;
      final ID dict = Foundation.invoke("NSMutableDictionary", "new");
      if (values != null) {
        for (Map.Entry<String, Object> me: values.entrySet()) {
          final Object val = me.getValue();
          if (val instanceof String)
            Foundation.invoke(dict,"setObject:forKey:", Foundation.nsString((String)val), Foundation.nsString(me.getKey()));
          else if (val instanceof Map) {
            final ID internalDict = Foundation.invoke("NSMutableDictionary", "new");
            Foundation.invoke(dict,"setObject:forKey:", internalDict, Foundation.nsString(me.getKey()));
          } else
            LOG.error("unsupported type of domain value: " + val);
        }
      }
      Foundation.invoke(defaults, "setPersistentDomain:forName:", dict, Foundation.nsString(domainName));
    } finally {
      pool.drain();
    }
  }
public static void createPersistentDomain(@NotNull String domainName, @Nullable Map<String, Object> values)