Skip to content

Instantly share code, notes, and snippets.

@gilleain
Created September 15, 2010 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilleain/580595 to your computer and use it in GitHub Desktop.
Save gilleain/580595 to your computer and use it in GitHub Desktop.
public class TechnicallyJava {
public Map<Integer, Integer> zip(int[] a, int[] b) {
assert a.length == b.length;
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (int i = 0; i < a.length; i++) {
map.put(a[i], b[i]);
}
return map;
}
}
public int[] list(int...arr) { return arr; }
public static void main(String[] args) {
System.out.println(zip(list(0,1,2,3,4), list(0,1,2,3,4)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment