标签:抽象 arc dprint 分享 ural mit public alt inf
【定义】
表示object的集合
generic class:可以用于多种object,
抽象类的具体实现:
【ArrayList】
动态添加,只能加Non-primitive type,要初始化长度。
【compare】记忆方法:BT,T0
comparable:比较natural order
public void sortAndPrint() { Collections.sort(books); //natural order printCollection(); Collections.sort(books, new AuthorComparer()); printCollection(); Collections.sort(books, new YearComparer()); printCollection(); } //inner classes public class AuthorComparer implements Comparator <Book> { public int compare(Book b1, Book b2) { return b1.author.compareTo(b2.author); }} public class YearComparer implements Comparator <Book> { public int compare(Book b1, Book b2) { return (b1.year - b2.year); } }}
【iterator】
标签:抽象 arc dprint 分享 ural mit public alt inf
原文地址:https://www.cnblogs.com/immiao0319/p/9813561.html