Created
December 28, 2015 02:48
-
-
Save domgetter/93609123c0b8155220e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int[] numbers = {1, 2, 3, 4}; | |
HashMap myMap = new HashMap(); | |
for(int i; i < numbers.length(); i++) { | |
myMap.put(numbers[i], numbers[i]*numbers[i]); | |
} | |
// You will get a HashMap that looks like this: {1: 1, 2: 4, 3: 9, 4: 16} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment