In the projects we often do, we may encounter whether a collection contains data in another collection, then the problem arises. There is a method in the list collection called contains.
The following is a detailed introduction in the api
<!-- Generated by javadoc (build 1.6.0-beta2) on Fri Mar 09 12:52:05 CST 2007 -->
<noscript></noscript>boolean contains(Object o)
Collection<E>
contains
o
- the element to test for existence in the list
ClassCastException
- if the type of the specified element is incompatible with this list (optional)
NullPointerException
- if the specified element is null and this list does not allow null elements (optional)