#51: PrettyPrintXMLWriter fails with a java.util.NoSuchElementException (Java 1.7 only) by belingueres · Pull Request #52 · codehaus-plexus/plexus-utils

// TODO: change the below code to a more efficient expression when the library
// be ready to target Java 8.
String element = elementStack.removeLast();
write( "</" + element + ">" );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice unittest! This also confirms that the following works too:

        write( "</" );
        write( elementStack.removeLast() );
        write( ">" );

I prefer this, since it removes the variable creation and assignment explicitly.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is now out of sync, i.e.

removed the element into a variable first

:)