View Problem
Produce the combinations from two lists
Given two lists, produce the list of tuples formed by taking the combinations from the individual lists. E.g. given the letters
Submit a new solution for java or erlang
There are 21 other solutions in additional languages (clojure, cpp, csharp, fantom ...)
["a", "b", "c"] and the numbers [4, 5], produce the list: [["a", 4], ["b", 4], ["c", 4], ["a", 5], ["b", 5], ["c", 5]]
java 1.6 or later
SortedSet<AbstractMap.SimpleImmutableEntry<String, Integer> > combinations =
new TreeSet<AbstractMap.SimpleImmutableEntry<String, Integer> >(new CombinationComparator());
for (int number : numbers)
for (String letter : letters)
combinations.add(new AbstractMap.SimpleImmutableEntry<String, Integer>(letter, Integer.valueOf(number)));
new TreeSet<AbstractMap.SimpleImmutableEntry<String, Integer> >(new CombinationComparator());
for (int number : numbers)
for (String letter : letters)
combinations.add(new AbstractMap.SimpleImmutableEntry<String, Integer>(letter, Integer.valueOf(number)));
Submit a new solution for java or erlang
There are 21 other solutions in additional languages (clojure, cpp, csharp, fantom ...)




