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 @@ -664,17 +664,30 @@ public String toString() {
664
664
StringBuilder s = new StringBuilder ();
665
665
s .append ("{\n " );
666
666
s .append ("Vertices:\n " );
667
+
668
+ List <String > lines = new ArrayList <>();
667
669
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 );
669
675
}
676
+
670
677
s .append ("Edges:\n " );
678
+ lines = new ArrayList <>();
671
679
for (V source : outgoingEdges .keySet ()) {
672
680
for (V dest : outgoingEdges .get (source ).keySet ()) {
673
681
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 " );
675
683
}
676
684
}
677
685
}
686
+ Collections .sort (lines );
687
+ for (String line : lines ) {
688
+ s .append (line );
689
+ }
690
+
678
691
s .append ('}' );
679
692
return s .toString ();
680
693
}
You can’t perform that action at this time.
0 commit comments