code: public static void validateAllOrNone(Props props, String... keys) {
      Objects.requireNonNull(keys);
  
      boolean allExist = true;
      boolean someExist = false;
      for (String key : keys) {
        Object val = props.get(key);
        allExist &= val != null;
        someExist |= val != null;
      }
  
      if (someExist && !allExist) {
        throw new IllegalArgumentException(
            "Either all of properties exist or none of them should exist for " + Arrays
                .toString(keys));
      }
    }
docs: Validates if all of the keys exist of none of them exist
  
  @throws IllegalArgumentException only if some of the keys exist