code: public static String collapseWhitespace(final String value) {
          validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
          return value.trim().replaceAll("\\s\\s+", " ");
      }
docs: Replace consecutive whitespace characters with a single space.
  
  @param value input String
  @return collapsed String