Skip to content

Instantly share code, notes, and snippets.

@ajbinky
Created October 25, 2017 19:27
Show Gist options
  • Save ajbinky/3af542177f71c7ee684c967db8b62f99 to your computer and use it in GitHub Desktop.
Save ajbinky/3af542177f71c7ee684c967db8b62f99 to your computer and use it in GitHub Desktop.
package arrays;
import java.util.ArrayList;
import java.util.Random;
public class ArrayLists {
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<>();
Random randy = new Random();
System.out.println("arraylist size: " + list.size());
for (int i = 0; i < 1000000; i++) {
list.add(randy.nextInt());
}
System.out.println("arraylist size: " + list.size());
for (int i = 0; i < 1000000; i++) {
System.out.println(list.get(i));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment