public static @NonNull <T> ArrayList<T> add(@Nullable ArrayList<T> cur, T val) {
    if (cur == null) {
      cur = new ArrayList<>();
    }
    cur.add(val);
    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