原文网址:Spring工具类--CollectionUtils的使用_IT利刃出鞘的博客-CSDN博客
本文介绍Spring的CollectionUtils的使用。
CollectionUtils工具类的作用:操作Collection,比如:List、Set。
| 方法 | 作用 |
| static boolean isEmpty (Collection> collection) | 判断集合是否为空。 |
| static boolean isEmpty(Map,?> map) | 判断Map是否为空 |
| static boolean containsInstance ( Collection> collection, Object element ) | 判断集合中是否包含某个对象 |
| static boolean contains ( Iterator> iterator, Object element ) | 通过迭代器判断某个对象是否在集合中。 |
| static boolean containsAny ( Collection> source, Collection> candidates ) | 判断集合中是否包含某些对象中的任意一个。 |
| static boolean hasUniqueObject (Collection> collection) | 判断集合中的每个元素是否唯一。即集合中不存在重复元素。 |
| 方法 | 作用 |
| static Object array, Collection ) | 将数组中的元素都添加到集合中。 |
| static Properties props, Map ) | 将 Properties 中的键值对都添加到 Map 中 |
上边是文章的部分内容,为便于维护,全文已转移到此网址:Spring工具类-CollectionUtils的使用 - 自学精灵