class PathUtils {

  public static final String normalize(final String path) {
    if (Strings.isNullOrEmpty(Preconditions.checkNotNull(path))) {
      return path;
    }

    final StringBuilder builder = new StringBuilder();
    char last = path.charAt(0);
    builder.append(last);
    for (int i=1; i<path.length(); i++) {
      char cur = path.charAt(i);
      if (last == '/' && cur == last) {
        continue;
      }
      builder.append(cur);
      last = cur;
    }
    return builder.toString();
  }

}