Permalink
Browse files

Form the result view to be more human readable

  • Loading branch information...
1 parent fa26f11 commit 547c2dbb0865f49013efb862d05ac2ce67bffa3a Kristiono Setyadi committed Feb 18, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/com/ksetyadi/randompair/RandomPair.java
@@ -6,6 +6,7 @@
import java.util.List;
import java.util.Map;
import java.util.Scanner;
+import java.util.Set;
public class RandomPair {
private static List<String> originalList;
@@ -18,7 +19,8 @@ public static void main(String[] args) {
Scanner s = new Scanner(System.in);
while(s.hasNextLine()) {
- originalList.add(s.nextLine());
+ String line = s.nextLine();
+ originalList.add(line);
}
if (originalList.size() % 2 != 0) {
@@ -27,8 +29,14 @@ public static void main(String[] args) {
}
resultPair = generateResultPair(originalList);
+ Set<String> keySet = resultPair.keySet();
+
+ int i = 1;
- System.out.println(resultPair.toString());
+ for (String key : keySet) {
+ System.out.printf("Team #%d: %s - %s\n", i, key, resultPair.get(key));
+ i++;
+ }
}
private static Map<String, String> generateResultPair(List<String> list) {

0 comments on commit 547c2db

Please sign in to comment.