Java 5.0 introduces Generics which eases the job of programmers. Generic type aims to prevent typecasting issues. <> notation is used to give type of Collection.

Java Code:
ArrayList<Integer> arrayList = new ArrayList<Integer>();
arrayList.add(10);
arrayList.add(20);

int total = arrayList.get(0) + arrayList.get(1);
System.out.println(total);