1.数组转为List集合

      Arrays.asList(postCodeOld.split(","))

2.List集合转为HashSet集合

            HashSet<String> set = new HashSet<String>(Arrays.asList(postCodeOld.split(",")));

3.

      HashSet<String> set = new HashSet<String>(Arrays.asList(postCodeOld.split(",")));

4.判断

     set.retainAll(Arrays.asList(postCodeNew.split(",")));
     if(set.size() !=  0){
         result =  false;
     }

源码:

数组/List集合判断是否有交集--retainAll()

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2021-09-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
相关资源
相似解决方案