I need help with #3 and #5.
Create a collection and fill it with 20 random numbers between 1 and 15 (inclusive)
List<Integer> list1 = new ArrayList<Integer>(Arrays.asList( rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1), rand.nextInt(15 + 1) ));
Print the numbers
System.out.println(list1);
Seed the constructor of class Random with the value 13.
- what does it mean to seed the ctor?
Serialize the collection to a file called Numbers.ser
try (ObjectOutputStream serialize = new ObjectOutputStream(new FileOutputStream("src/serialize/Numbers.ser"))) { serialize.writeObject(list1); } catch (IOException e) { e.printStackTrace(); }
Deserialize the file into a new collection called numberFromFile. Remove all duplicate numbers
- This is where I am confused on how to deserialize. What is the explanation?