Return the most specific type that makes sense for use. For example, if you have a method of creating a new collection, or you can easily wrap a collection in an unmodifiable shell, returning the collection as Collection or even List or Set , makes the client developer life a little easier.
The Iterable return makes sense for code in which values can be generated on the fly; you could imagine, for example, the Fibonacci generator that created Iterator , which calculated the next number instead of trying to save some lookup table. If you are writing a framework or interface code where such a “streaming” kind of API can be useful (Guava and its functional classes do this a little), then specifying Iterable instead of the type of the collection may be worth the loss of flexibility on the consumer side.
source share