Consider replacing Guava Lists.newArrayList (and similar) usage? #39
Replies: 1 comment 1 reply
-
I'm on board with this change. We should use native APIs as much as possible. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For unmodifiable lists, sets, and maps, should we use Java's factory methods that were added in JDK 9 (collection factory methods)?
This would include replacing
Lists.newArrayList()
withList.of()
andSets.newHashSet()
withSet.of()
.Obviously, if the list or set isn't unmodifiable (i.e. elements are added after construction) then we can't make this change (without other design changes). In those cases, I'd recommend we stick with the Guava factory methods since you can "one-liner" create them with elements.
Beta Was this translation helpful? Give feedback.
All reactions