摘要:
Examplepublicstatic final ImmutableSet COLOR_NAMES =ImmutableSet.of( "red", "orange", "yellow", "green", "blue", "purple");classFoo{ Set bars; Foo(Set bars){ this.bars =ImmutableSet.copyOf(bars);// defensive copy! }}Why?Immutable objects ha 阅读全文