/** * Factory method to create an unmodifiable collection. * <p/> * If the collection passed in is already unmodifiable, it is returned. * * @param coll * the collection to decorate, must not be null * @return an unmodifiable collection * @throws IllegalArgumentException * if collection is null */ public static <E> Collection<E> decorate(Collection<E> coll) { if (coll instanceof Unmodifiable) { return coll; } return new UnmodifiableCollection<E>(coll); }