In my application I use 3rd party library (Spring Data for MongoDB to be exact).
Methods of this library return Iterable, while the rest of my
I came across a similar situation while trying to fetch a List of Projects, rather than the default Iterable declared in CrudRepository interface. So, in my ProjectRepository interface (which extends from CrudRepository), I simply declared the findAll() method to return a List instead of Iterable.
package com.example.projectmanagement.dao;
import com.example.projectmanagement.entities.Project;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface ProjectRepository extends CrudRepository {
@Override
List findAll();
}
This is the simplest solution, I think, without requiring conversion logic or usage of external libraries.