package org.onap.vid.utils; import java.util.List; import java.util.stream.Collectors; /** * Created by moriya1 on 10/10/2017. */ public class Intersection { public List intersectMultipileArray(List> lists) { if (lists.size() == 1) { return lists.get(0); } else { List intersectResult = intersectTwoArrays(lists.get(0),lists.get(1)); lists.remove(0); lists.remove(0); lists.add(0,intersectResult); return intersectMultipileArray(lists); } } public List intersectTwoArrays(List list1, List list2) { List intersect = list1.stream() .filter(list2::contains) .collect(Collectors.toList()); return intersect; } }