@Override
    public Path normalize() {
        // quadratic
        LinkedList<String> tmpList = new LinkedList<>(parts);

        boolean changed = true;
        while (tmpList.size() > 0 && changed) {
            changed = false;

            String prev = "";
            for (ListIterator<String> it = tmpList.listIterator(); it.hasNext(); ) {
                int index = it.nextIndex();
                String s = it.next();
                if (s.equals(".")) {
                    changed = true;
                    it.remove();
                    break;
                } else if (index > 0 && s.equals("..") && !prev.equals("..")) {
                    changed = true;
                    it.remove();
                    it.previous();
                    it.remove();
                    break;
                }

                prev = s;
            }
        }

        if (tmpList.size() == 0)
            return getRoot();

        return new UnixPseudoPath(isAbsolute(), tmpList);
    }