- 博客(3)
- 收藏
- 关注
原创 treeMap 的多种遍历方式以及比较器和comparable的实现
treeMap 的多种遍历方式以及比较器和comparable的实现 1、使用keySet()方法转化为set集合,再通过遍历set集合通过TreeMap集合中的get方法获取value 2、使用TreeyMap集合中的entrySet将key和value一起转化为一个Set集合,再通过遍历set集合来获得原TreeMap集合中的key和value 3、两种比较方法:(1)写一个比较器传入到TreeMap的构造方法中(2)放在key上的自定义数据类型重写comparable方法 4、发现的问题:..
2020-12-06 10:36:01 749
原创 2020-11-28
简单的单向链表模拟 先写一个节点类Node public class Node { Object date;//存储的数据 Node next;//下一个节点地址 public Node() {//无参数构造方法 } public Node(Object date, Node next) {//有参数构造方法 this.date = date; this.next = next; } } 再写一个模拟链表的类Lin
2020-11-28 11:56:01 80
原创 2020-11-28
统计身高档次,分为八档 public class 统计身高档次 { public static void main(String[] args) { Scanner enter=new Scanner(System.in); int[] da=new int[9]; int input_Number=2; System.out.println("请输入身高:输入0退出"); while (input_Number!=
2020-11-28 11:16:46 167
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人