File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
src/edu/stanford/nlp/graph Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -666,17 +666,30 @@ public String toString() {
666666 StringBuilder s = new StringBuilder ();
667667 s .append ("{\n " );
668668 s .append ("Vertices:\n " );
669+
670+ List <String > lines = new ArrayList <>();
669671 for (V vertex : outgoingEdges .keySet ()) {
670- s .append (" " ).append (vertex ).append ('\n' );
672+ lines .add (" " + vertex + '\n' );
673+ }
674+ Collections .sort (lines );
675+ for (String line : lines ) {
676+ s .append (line );
671677 }
678+
672679 s .append ("Edges:\n " );
680+ lines = new ArrayList <>();
673681 for (V source : outgoingEdges .keySet ()) {
674682 for (V dest : outgoingEdges .get (source ).keySet ()) {
675683 for (E edge : outgoingEdges .get (source ).get (dest )) {
676- s . append (" " ). append ( source ). append ( " -> " ). append ( dest ). append ( " : " ). append ( edge ). append ( '\n' );
684+ lines . add (" " + source + " -> " + dest + " : " + edge + " \n " );
677685 }
678686 }
679687 }
688+ Collections .sort (lines );
689+ for (String line : lines ) {
690+ s .append (line );
691+ }
692+
680693 s .append ('}' );
681694 return s .toString ();
682695 }
You can’t perform that action at this time.
0 commit comments