code: @Override
      public UnixSshPath relativize( Path other ) {
          if ( other == null ) {
              throw new NullPointerException();
          }
          if ( !(other instanceof UnixSshPath) ) {
              throw new ProviderMismatchException();
          }
  
          UnixSshPath unixOther = (UnixSshPath) other;
          if ( isAbsolute() && !unixOther.isAbsolute() ) {
              throw new IllegalArgumentException( "this and other must have same isAbsolute" );
          }
  
          if ( getNameCount() == 0 ) {
              return unixOther;
          }
  
          Path relative = null;
          Path remainingOther = null;
          Iterator<Path> otherIterator = unixOther.iterator();
          for ( Path part : this ) {
              if ( relative != null ) {
                  relative = relative.resolve( ".." );
                  continue;
              }
  
              if ( otherIterator.hasNext() ) {
                  Path otherPart = otherIterator.next();
                  if ( !part.equals( otherPart ) ) {
                      remainingOther = otherPart;
                      while ( otherIterator.hasNext() ) {
                          remainingOther = remainingOther.resolve(
                                  otherIterator.next() );
                      }
                      relative = new UnixSshPath( getFileSystem(), ".." );
                  }
              }
              else {
                  relative = new UnixSshPath( getFileSystem(), ".." );
              }
          }
  
          if ( relative == null ) {
              while ( otherIterator.hasNext() ) {
                  if ( remainingOther == null ) {
                      remainingOther = new UnixSshPath( getFileSystem(), "" );
                  }
                  else {
                      remainingOther = remainingOther.resolve(
                              otherIterator.next() );
                  }
              }
              return remainingOther == null
                      ? new UnixSshPath( getFileSystem(), "" )
                      : (UnixSshPath) remainingOther;
          }
          return remainingOther == null
                  ? (UnixSshPath) relative
                  : (UnixSshPath) relative.resolve( remainingOther );
      }
docs: {@inheritDoc}