private < T > List < T > immutableAdd ( List < T > list , T element ) { List < T > result = new ArrayList < T > ( list ) ; result . add ( element ) ; return Collections . unmodifiableList ( result ) ; }
Helpers for working with immutable lists