Coding in the small with Google Collections: ImmutableList.copyOf
Part 5 in a Series. ImmutableList.copyOf() creates an immutable copy of it's arguments as a List. Wherever your code stores a List parameter, it may need an immutable copy. With the JDK, coping and preventing modification requires two steps. Lists.immutableList simplifies this code: Before: public Directions(Address from,…