package com.company; import java.util.*;
public class Main {
public static void main(String[] args) {
ArrayList<Integer> integers = new ArrayList<>();
for (int i = 0; i < 20000000; i++) {
integers.add((int) (Math.random()*20000000));
}
HashSet<Integer> unique = new HashSet<>(integers);
System.out.println("Number of items in a list of numbers: " + integers.size());
System.out.println("Number of unique elements: " + unique.size());
}
}
Aucun commentaire:
Enregistrer un commentaire