摘要: Comparable和Comparator接口都是用来实现集合中元素的比较, 编写Student类实现接口Comparable: 测试类: 编写Student不实现接口Comparator: 测试类: 阅读全文
posted @ 2017-10-27 12:05 千彧 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 一:快速失败(fail—fast) 在用迭代器遍历一个集合对象时,如果遍历过程中对集合对象的内容进行了修改(增加、删除、修改),则会抛出Concurrent Modification Exception。 原理:迭代器在遍历时直接访问集合中的内容,并且在遍历过程中使用一个 modCount 变量。集 阅读全文
posted @ 2017-10-27 10:05 千彧 阅读(167) 评论(0) 推荐(0) 编辑