code: @Trivial
      private static String collapseWhitespace(String value) {
          final int length = value.length();
          for (int i = 0; i < length; ++i) {
              if (isSpace(value.charAt(i))) {
                  return collapse0(value, i, length);
              }
          }
          return value;
      }
docs: Collapses contiguous sequences of whitespace to a single 0x20.
  Leading and trailing whitespace is removed.