File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -230,12 +230,29 @@ private String rankReason(HashMap<String, Boolean> criteria) {
230230 if (passes == 0 ) {
231231 reason = "none" ;
232232 } else {
233+ // Only in Java
234+ // Would Such
235+ // A Mess Exist
236+ //
233237 String s = " | " ;
238+ String [] p = new String [passes ];
234239 Iterator it = criteria .entrySet ().iterator ();
240+ int i = 0 ;
241+
242+ // collect true entries
235243 while (it .hasNext ()) {
236244 Map .Entry pair = (Map .Entry )it .next ();
237- reason += (String )pair .getKey ();
238- if (it .hasNext ()) {
245+ if ((Boolean )pair .getValue () == true ) {
246+ p [i ++] = (String )pair .getKey ();
247+ }
248+ }
249+
250+ // merge them into a string
251+ for (int k = 0 ; k < i ; k ++) {
252+ reason += p [k ];
253+ // do not append the separator to the last
254+ // element listed
255+ if (k < i -1 ) {
239256 reason += s ;
240257 }
241258 }
You can’t perform that action at this time.
0 commit comments