java基础_集合
烦到困
学习的痛苦......是终生的
展开
-
遍历集合的三种方式
遍历集合的三种方式 for(){} public class ArrayListTest2 { public static void main(String[] args) { // TODO Auto-generated method stub // 不能实例化List的对象 // ArrayList 允许重复的对象 ...原创 2018-11-13 15:37:48 · 153 阅读 · 0 评论 -
List的删除
使用List的remove方式 public class ArrayListTest2 { public static void main(String[] args) { // TODO Auto-generated method stub // 不能实例化List的对象 // ArrayList 允许重复的对象 ...原创 2018-11-13 16:18:58 · 619 阅读 · 1 评论 -
更改TreeSet的排序方式
TreeSet 的排序方式 一 让元素本身具有比较性,需要实现Comparable接口 覆盖compareTo方法 class Student implements Comparable{ //重写compareto方法进行排序 int age; String name; Student(String name,int age){ this.name=name; this...原创 2018-12-04 16:48:46 · 737 阅读 · 0 评论