public static void main(String[] args){ Contact tmp1 = new Contact(); tmp1.setName("aac"); Contact tmp2 = new Contact(); tmp2.setName("abc"); Contact tmp3 = new Contact(); tmp3.setName("aab"); Contact tmp4 = new Contact(); tmp4.setName("qwe"); ContactList testList = new ContactList(); testList.add(tmp4); testList.add(tmp1); testList.add(tmp2); testList.add(tmp3); System.out.println(testList.getSortedCollection("a").toString()); }