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
.
Stuck? You may find these lessons helpful: