Java基础
zeng_z
这个作者很懒,什么都没留下…
展开
-
交并差集操作
Collection提供了集合的操作方法,具体方法如下 addAll:并集 retainAll:交集 removeAll:差集 Set<Integer> result = new HashSet<Integer>(); Set<Integer> set1 = new HashSet<Integer>(){{ add(1); add(3); add(5); }}; Set<Integer> set2 = new HashSet<In原创 2021-09-09 14:24:47 · 129 阅读 · 0 评论 -
Calendar类的使用
初始化 Calendar calendar = Calendar.getInstance(); 设置年月日 设置类的思路:围绕set方法展开 如果要设置日期,就使用Calendar.DATE 如果要设置月份,就使用Calendar.MONTH,这里有一个注意事项,MONTH的起始月份是从0开始的,0表示1月,11表示11月 如果要设置年份,就使用Calendar.YEAR 注意两个关键函数: calendar.getActua...原创 2021-09-09 14:17:28 · 1034 阅读 · 0 评论