MCPcopy Create free account
hub / github.com/Bit0r/java-util / getListIntersection

Method getListIntersection

src/main/java/util/CommonUtils.java:556–569  ·  view source on GitHub ↗

多个list取交集 @param lists @return

(List... lists)

Source from the content-addressed store, hash-verified

554 * @return
555 */
556 public static List<String> getListIntersection(List... lists){
557 if(ObjectUtils.isEmpty(lists)){
558 return new ArrayList();
559 }
560 List<List> dataList = new ArrayList(Arrays.asList(lists));
561 List<String> intersectionList = dataList.get(0);
562 for (List data : dataList){
563 if(ObjectUtils.isEmpty(data)){
564 return new ArrayList();
565 }
566 intersectionList = intersectionList.stream().filter(item -> data.contains(item)).collect(toList());
567 }
568 return intersectionList;
569 }
570
571 /**
572 * 获取服务器ip

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected