Kubernate

Java 8 # Intersection

 import java.util.List;

import java.util.stream.Collectors;


public class Intersection {

    public static List<Integer> findIntersection(List<Integer> list1, List<Integer> list2) {

        return list1.stream()

                .distinct()

                .filter(list2::contains)

                .collect(Collectors.toList());

    }

}


No comments:

Post a Comment

OpenAI Agent SDK

  OpenAI Agents SDK

Kubernate