Skip to content

Instantly share code, notes, and snippets.

@begetan
Created December 16, 2016 12:12
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 begetan/3bf5652ef0b30e92632208a4578ea3a3 to your computer and use it in GitHub Desktop.
Save begetan/3bf5652ef0b30e92632208a4578ea3a3 to your computer and use it in GitHub Desktop.
// Simple demonstration of HashMap.
import java.util.*;
public class Test {
public static void main(String[] args) {
Random rand = new Random(47);
Map<Integer,Boolean> m =
new HashMap<Integer,Boolean>();
for(int i = 0; i < 1000000000; i++) {
m.put(rand.nextInt(30),Boolean.TRUE);
}
System.out.println(m);
}
} /* Output:
{0=true, 1=true, 2=true, 3=true, 4=true, 5=true, 6=true, 7=true, 8=true, 9=true, 10=true, 11=true, 12=true, 13=true, 14=true, 15=true, 16=true, 17=true, 18=true, 19=true, 20=true, 21=true, 22=true, 23=true, 24=true, 25=true, 26=true, 27=true, 28=true, 29=true}
*///:~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment