Let's consider the case when the where clause of our JPQL or SQL query contains the IN (or NOT IN) keyword:
SELECT u FROM User u WHERE u.name IN :names
In this case, we can define a query method that takes Collection as a parameter:
@Query(value = "SELECT u FROM User u WHERE u.name IN :names")
List<User> findUserByNameList(@Param("names") Collection<String> names);
As the parameter is a Collection, it can be used with List, HashSet, etc