public static @Nullable <T> ArraySet<T> remove(@Nullable ArraySet<T> cur, T val) {
    if (cur == null) {
      return null;
    }
    cur.remove(val);
    if (cur.isEmpty()) {
      return null;
    } else {
      return cur;
    }
  }
Removes value from given array if present, providing set-like behavior.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/ArrayUtils.java