Findbugs throws warning for the following piece of code. Seems like a simple of Builder
class to add items and construct at the end. Whats the issue here ?
public static Set<Entity> convert(@NonNull final String id,
@NonNull final Collection<SomeEntity> list) {
Builder<Entity> builder = new ImmutableSet.Builder<>();
final Entity entityOfType1 = createEntity(..);
// Bug type RV_RETURN_VALUE_IGNORED
builder.add(entityOfType1);
final Set<Entity> entitiesOfType2 = createEntity(..);
// Bug type RV_RETURN_VALUE_IGNORED
builder.addAll(entitiesOfType2);
final Set<Entity> entitiesOfType3 = createEntity(..);
// Bug type RV_RETURN_VALUE_IGNORED
builder.addAll(entitiesOfType3);
return builder.build();
}