question: public NamePath withHead ( String newHead ) { List < String > newPathPieces = new ArrayList < > ( ) ; newPathPieces . addAll ( pathPieces ) ; newPathPieces . set ( pathPieces . size ( ) - 1 , newHead ) ; return new NamePath ( newPathPieces ) ; }
target:  Create a new NamePath where the head (the last piece) is replaced with the given newHead. 