Kotlinlearncs.online LogoJava
Return to List

Solve: List Intersection

Created By: Justin Maier
/ Version: 2024.11.0

Write a method named listIntersection that takes two List<Integer> arguments and returns a new List<Integer> that represents the intersection of the argument lists. That is, it contains only the elements that are in both the argument lists.

This will be made easier by using the List's contains method.

Keep in mind that either List may be null.

Related Lessons

Stuck? You may find these lessons helpful: