import java.util.ArrayList;
public class DynamicCollectionExample {
public static void main(String[] args) {
ArrayList<Integer> dynamicCollection = new ArrayList<>();
for (int i = 0; i < 1000000; i++) {
dynamicCollection.add(i);
}
for (int num : dynamicCollection) {
if (num % 2 == 0) {
}
}
dynamicCollection.sort(Integer::compareTo);
System.out.println(dynamicCollection);
}
}