ObjectOutputStream – Writing single Objects with for-loop or writing an arrayList<Object>?

Which one it's better to use overall?, considering that I'm always going to write multiple objects in the project at once.

private static void main(String[] args) {
            ArrayList<String> stringArrayList = new ArrayList<>();
            stringArrayList.add("1");
            stringArrayList.add("2");
            try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("file.dat"))) {
                // this
                for (String s : stringArrayList) {
                    oos.writeObject(s);
                }
                // or this
                oos.writeObject(stringArrayList);
            } catch (IOException e) {
                e.printStackTrace();
            }
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum