What is the most efficient (performant) way to create a list with just one element?
Just use:
Collections#singletonList()
, which returns a List
, orCollections#singleton()
, which returns a Set
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With