public static Boolean isEmpty()

in streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/base/util/CommonUtils.java [63:121]


  public static Boolean isEmpty(Object... objs) {

    if (objs == null) {
      return Boolean.TRUE;
    }

    if (objs.length == 0) {
      return Boolean.TRUE;
    }

    for (Object obj : objs) {
      if (obj == null) {
        return true;
      }

      // char sequence
      if ((obj instanceof CharSequence) && "".equals(obj.toString().trim())) {
        return true;
      }
      // collection
      if (obj instanceof Collection) {
        if (((Collection<?>) obj).isEmpty()) {
          return true;
        }
      }
      // map
      if (obj instanceof Map) {
        if (((Map<?, ?>) obj).isEmpty()) {
          return true;
        }
      }

      if (obj instanceof Iterable) {
        if (((Iterable<?>) obj).iterator() == null || !((Iterable<?>) obj).iterator().hasNext()) {
          return true;
        }
      }

      // iterator
      if (obj instanceof Iterator) {
        if (!((Iterator<?>) obj).hasNext()) {
          return true;
        }
      }

      // file
      if (obj instanceof File) {
        if (!((File) obj).exists()) {
          return true;
        }
      }

      if ((obj instanceof Object[]) && ((Object[]) obj).length == 0) {
        return true;
      }
    }

    return false;
  }