java - Transform and convert a List to Set with Guava - Stack Overflow
This creates an ImmutableSet, which does not accept null. So if you want your Set to contain null, you'll have to use another solution, like the one you're currently using.
Note that, if it's the creation of the temporary collection that bothers you, you shouldn't be bothered. No copy is made. The collection is simply a view over the original list.
Read full article from java - Transform and convert a List to Set with Guava - Stack Overflow
No comments:
Post a Comment