@Test public void testCombine() throws Exception { SplitCommaReverseService service = new SplitCommaReverseService(); List<String> list = new ArrayList<String>(); list.add(PART0); list.add(PART1); list.add(PART2); Assert.assertEquals(FULL, service.combine(list)); }
public String combine(List<String> matchedStrings) { StringBuilder sb = new StringBuilder(); for (int i = matchedStrings.size() - 1; i >= 0; i--) { sb.append(matchedStrings.get(i)); sb.append(", "); } if (sb.length() == 0) { return ""; } else { return sb.substring(0, sb.length() - 2); } }
SplitCommaReverseService implements SplitGeocoderStringService { public String combine(List<String> matchedStrings) { StringBuilder sb = new StringBuilder(); for (int i = matchedStrings.size() - 1; i >= 0; i--) { sb.append(matchedStrings.get(i)); sb.append(", "); } if (sb.length() == 0) { return ""; } else { return sb.substring(0, sb.length() - 2); } } }
SplitCommaReverseService implements SplitGeocoderStringService { public String combine(List<String> matchedStrings) { StringBuilder sb = new StringBuilder(); for (int i = matchedStrings.size() - 1; i >= 0; i--) { sb.append(matchedStrings.get(i)); sb.append(", "); } if (sb.length() == 0) { return ""; } else { return sb.substring(0, sb.length() - 2); } }  }
SplitCommaReverseService implements SplitGeocoderStringService { public String combine(List<String> matchedStrings) { StringBuilder sb = new StringBuilder(); for (int i = matchedStrings.size() - 1; i >= 0; i--) { sb.append(matchedStrings.get(i)); sb.append(", "); } if (sb.length() == 0) { return ""; } else { return sb.substring(0, sb.length() - 2); } }  List<String> split(String location); String combine(List<String> matchedStrings); }
SplitCommaReverseService implements SplitGeocoderStringService { public String combine(List<String> matchedStrings) { StringBuilder sb = new StringBuilder(); for (int i = matchedStrings.size() - 1; i >= 0; i--) { sb.append(matchedStrings.get(i)); sb.append(", "); } if (sb.length() == 0) { return ""; } else { return sb.substring(0, sb.length() - 2); } }  List<String> split(String location); String combine(List<String> matchedStrings);  }