private static void appendDiff( StringBuilder buf, Diff diff, Diff prevDiff ) {
		if( diff == null )
			return;

		String prefix = keyPrefix( diff.key );
		if( !prefix.isEmpty() ) {
			if( prevDiff == null || !prefix.equals( keyPrefix( prevDiff.key ) ) ) {
				if( prevDiff != null )
					buf.append( "\n\n" );
				buf.append( "#---- " ).append( prefix ).append( " ----\n\n" );
			} else if( prevDiff != null ) {
				// append empty line only if necessary
				if( !((prevDiff.value1 != null && prevDiff.value2 == null && diff.value1 != null && diff.value2 == null) ||
					  (prevDiff.value1 == null && prevDiff.value2 != null && diff.value1 == null && diff.value2 != null)) )
					buf.append( '\n' );
			}
		}

		if( diff.value1 != null )
			buf.append( "- " ).append( diff.key ).append( diff.value1 ).append( '\n' );
		if( diff.value2 != null )
			buf.append( "+ " ).append( diff.key ).append( diff.value2 ).append( '\n' );

		if( prefix.isEmpty() )
			buf.append( '\n' );
	}
Dumps look and feel UI defaults to files.

@author Karl Tauber
flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/uidefaults/UIDefaultsDump.java