Null default for empty collections is annoying
Open
Component: value
P3
type=addition
- Dominant language
- Java
- Stars
- 10.6k
- Forks
- 1.2k
- Avg merge
- 6h 32m
- Merged PRs (30d)
- 13
Description
It's very annoying to have to write:
```java
@AutoValue.Builder
public abstract static class Builder {
public static Builder create() {
return new AutoValue_MyType.Builder()
.setCharges(emptyList())
.setPayments(emptyList())
.setParticipants(emptyList())
.setTags(emptyList());
}
```
just to ensure that a field `@Nonnull public abstract List getCharges()` defaults to empty-list on the builder instead of null. It would be nice to have some way to specify a default for non-primitive non-null types.
Contributor guide
Assessment
This issue has not been assessed yet.