vendredi 24 juin 2016

Interface with concrete classes

If we consider two implementations below, what's the actual use of the first one?

List<String> a= new ArrayList<String>();
ArrayList<String> b= new ArrayList<String>();

From what I have read in the posts, the first implementation helps in avoiding breaking change like we can change the implementation again as

a=new TreeList<String>();

But I don't understand whats the actual use of changing the implementation with treelist as we can use only the List interface methods?

Aucun commentaire:

Enregistrer un commentaire