When using Dagger Multibinding, you can use methods like the below to make sure that there’s a (potentially empty) Set binding for your type:
@Provides @ElementsIntoSet Set<MyType> provideEmptySetOfMyType() {
return new HashSet<>();
}
However, there’s a slightly easier way to express this:
@Multibinds abstract Set<MyType> provideEmptySetOfMyType();
Suppress false positives by adding the suppression annotation @SuppressWarnings("EmptySetMultibindingContributions")
to the enclosing element.