class UriComponent {

    public static URI normalize(URI uri) {
        String oldPath = uri.getRawPath();
        if (Strings.isNullOrEmpty(oldPath)) {
            return uri;
        }
        String normalizedPath = normalize(oldPath);
        if (normalizedPath.equals(oldPath)) {
            // nothing to do, URI was normalized
            return uri;
        }
        return UriBuilder.fromUri(uri).replacePath(normalizedPath).build();
    }

    private  UriComponent();

}