File tree 1 file changed +15
-2
lines changed
src/edu/stanford/nlp/graph
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -666,17 +666,30 @@ public String toString() {
666
666
StringBuilder s = new StringBuilder ();
667
667
s .append ("{\n " );
668
668
s .append ("Vertices:\n " );
669
+
670
+ List <String > lines = new ArrayList <>();
669
671
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 );
671
677
}
678
+
672
679
s .append ("Edges:\n " );
680
+ lines = new ArrayList <>();
673
681
for (V source : outgoingEdges .keySet ()) {
674
682
for (V dest : outgoingEdges .get (source ).keySet ()) {
675
683
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 " );
677
685
}
678
686
}
679
687
}
688
+ Collections .sort (lines );
689
+ for (String line : lines ) {
690
+ s .append (line );
691
+ }
692
+
680
693
s .append ('}' );
681
694
return s .toString ();
682
695
}
You can’t perform that action at this time.
0 commit comments