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 @@ -664,17 +664,30 @@ public String toString() {
664664 StringBuilder s = new StringBuilder ();
665665 s .append ("{\n " );
666666 s .append ("Vertices:\n " );
667+
668+ List <String > lines = new ArrayList <>();
667669 for (V vertex : outgoingEdges .keySet ()) {
668- s .append (" " ).append (vertex ).append ('\n' );
670+ lines .add (" " + vertex + '\n' );
671+ }
672+ Collections .sort (lines );
673+ for (String line : lines ) {
674+ s .append (line );
669675 }
676+
670677 s .append ("Edges:\n " );
678+ lines = new ArrayList <>();
671679 for (V source : outgoingEdges .keySet ()) {
672680 for (V dest : outgoingEdges .get (source ).keySet ()) {
673681 for (E edge : outgoingEdges .get (source ).get (dest )) {
674- s . append (" " ). append ( source ). append ( " -> " ). append ( dest ). append ( " : " ). append ( edge ). append ( '\n' );
682+ lines . add (" " + source + " -> " + dest + " : " + edge + " \n " );
675683 }
676684 }
677685 }
686+ Collections .sort (lines );
687+ for (String line : lines ) {
688+ s .append (line );
689+ }
690+
678691 s .append ('}' );
679692 return s .toString ();
680693 }
You can’t perform that action at this time.
0 commit comments