I am noticing when I create an array list of any specific type of object I need to initialize it like this:
List<Object> objectList = new ArrayList<Object>();
Why must I initialize the right hand side containing the Object? I.e., why can't I initialize it without identifying the Object class again? - like
List<Object> objectList = new ArrayList<>();
If I can, why can I do it and what is the benefit (or loss thereof) of doing it either way?
I have researched this, and the only thing I am finding is the initialization including the second object. I want to know the 'why' of the way this is structured.
I am aware (now) that this question has an explicit answer (I found What is the point of the diamond operator in Java 7? here), but I left this because the research was very difficult without knowing the term 'diamond operator'.