Java ArrayList, HashSet, HashMap, array间的常见转换
发布时间
阅读量:
阅读量
文章结构概览
-
- ArrayList
-
- 将 ArrayList 转换为 数组
- 将 ArrayList 转换为 HashSet
-
HashSet
-
- 将 HashSet 转换为 ArrayList
- 将 HashSet 转换为 数组
-
HashMap
-
- 将 HashMap 转换为 ArrayList
- 将 HashMap 转换为 HashSet
-
数组
-
- 将 数组 转换为 ArrayList
- 将 数组 转换为 HashSet
-
- ArrayList
ArrayList
ArrayList转数组方法解析
T可接受String、Integer、Character等封装类型
List<T> list =new ArrayList<>();
T[] arr = (T[])list.toArray(new T[list.size()]);
ArrayList 转 HashSet
T可接受String、Integer、Character等包装类类型
List<T> list =new
全部评论 (0)
还没有任何评论哟~
