Developing Java, you have always learned that its best to create an ArrayList by using the List interface as the type for the variable the list is stored in. Like this
List<String> myList = new ArrayList<String>();
However, by looking at a lot of the android examples that is included in the bundle, they have created the list by using the Class.
ArrayList<String> myList = new ArrayList<String>();
Is there any reason why this is done? Is it faster, lighter or something to explicitly setting the Class?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…