用Set类判断Map里key是否存在的示例代码

时间:2021-09-22 17:21:02

代码如下:


public boolean checkSGDLookPre(String sgdBrId, Ce_sysuser cuser) {
  if (cuser.getSu_RoleId() == 6) {
   return true;
  }
  String[] strArray = cuser.getUserViewBranchs().split(",");
  Set<String> strSet = new HashSet<String>();
  CollectionUtils.addAll(strSet, strArray);
  return strSet.contains(sgdBrId);
 }