Using util package

1 To implement a class to be capable to use hashset,  hashcode() and equals(Object o) need to be implemented.

 

2 Vector has method contains(), to make it work correctly, the equals(Object o) need to be implemented

 

3 the signature of equals()   is boolean equals(Object o), so generally, the first line is to test the instanceof methods.

 

4 To Collections.sort() ,  the comparable interface need to be implemented,  and implements the  int compareTo() method.

阅读更多
个人分类: Java
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭