Using the Diamond Operator when type is not obvious
import java.util.ArrayList; import java.util.List; public class Test { public static void main(String[] args) { List arrayList = new ArrayList<>(); //List<String> arrayList = new ArrayList<>(); arrayList.add("First"); arrayList.add("Second"); } }