So my Java tutor at school just started to teach us about Containers and there's this little concept I don't understand about initialization.
Firstly, with ArrayList, what's the difference between these two ways for initializing:
ArrayList list = new ArrayList();
ArrayList<Car> list = new ArrayList<Car>();
Secondly, what's the difference between these two ways for initializing:
List<String> list = new ArrayList<String>();
ArrayList<String> list = new ArrayList<String>();
Or:
Set<String> list = new HashSet<String>();
HashSet<String> list = new HashSet<String>();
Or:
Map<Integer, String> list = new HashMap<Integer, String>();
HashMap<Integer, String> list = new HashMap<Integer, String>();
P.S. When I'm asking what's the difference, I mean how will it affect my liberty to use certain methods on the collection or shift the data that is stored in it.
Thanks!!