web123456

The difference between

()、()

  • (strArray) The return value is still a mutable set, but the return value is its inner class and does not have an add method. The value can be changed through the set method. The default length is 10
  • () returns an immutable set, but this length set is only 1, which can reduce memory space. However, the returned value is still the internal implementation class of Collections, and there is no add method. If you call add, the set method will report an error.
//Call add() will report an error

How to elegantly convert an element into a collection

List<K> authcChannels = (K).collect(());