/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.collections4.collection;

import java.io.Serializable;
import java.util.Collection;

/**
 * Decorates another <code>Collection</code> to provide additional behaviour
 * without guaranteeing that the provided <code>Collection</code> type is the
 * same as that of the decorated <code>Collection</code>.
 * <p>
 * Each untyped method call made on this <code>Collection</code> is forwarded to the
 * decorated <code>Collection</code>. This class is used as a framework on which
 * to build to extensions such as synchronized and unmodifiable behaviour. The
 * main advantage of decoration is that one decorator can wrap any
 * implementation of <code>Collection</code>, whereas sub-classing requires a
 * new class to be written for each implementation.
 * <p>
 * This implementation does not perform any special processing with
 * {@link #iterator()}. Instead it simply returns the value from the wrapped
 * collection. This may be undesirable, for example if you are trying to write
 * an unmodifiable implementation it might provide a loophole.
 *
 * @param <D> the type of the elements in the decorated collection
 * @param <E> the element type of the Collection implementation
 * @since 4.0
 * @version $Id$
 */
public abstract class AbstractUntypedCollectionDecorator<E, D> implements Collection<E>, Serializable {

    /** Serialization version */
    private static final long serialVersionUID = -8016691444524268856L;

    /** The collection being decorated */
    protected Collection<D> collection;

    /**
     * Create a new AbstractUntypedCollectionDecorator.
     */
    public AbstractUntypedCollectionDecorator() {
        super();
    }

    /**
     * Gets the collection being decorated. All access to the decorated
     * collection goes via this method.
     * 
     * @return the decorated collection
     */
    protected Collection<D> decorated() {
        return collection;
    }

    public void clear() {
        decorated().clear();
    }

    public boolean contains(final Object object) {
        return decorated().contains(object);
    }

    public boolean isEmpty() {
        return decorated().isEmpty();
    }

    public boolean remove(final Object object) {
        return decorated().remove(object);
    }

    public int size() {
        return decorated().size();
    }

    public Object[] toArray() {
        return decorated().toArray();
    }

    public <T> T[] toArray(final T[] object) {
        return decorated().toArray(object);
    }

    public boolean containsAll(final Collection<?> coll) {
        return decorated().containsAll(coll);
    }

    public boolean removeAll(final Collection<?> coll) {
        return decorated().removeAll(coll);
    }

    public boolean retainAll(final Collection<?> coll) {
        return decorated().retainAll(coll);
    }

    @Override
    public boolean equals(final Object object) {
        return object == this || decorated().equals(object);
    }

    @Override
    public int hashCode() {
        return decorated().hashCode();
    }

    @Override
    public String toString() {
        return decorated().toString();
    }

}

@@ -2473,24 +2473,456 @@
 r();%0A    %7D%0A%0A
+    /**%0A     * Constructor that wraps (not copies).%0A     * %0A     * @param coll  the collection to decorate, must not be null%0A     * @throws IllegalArgumentException if the collection is null%0A     */%0A    protected AbstractUntypedCollectionDecorator(final Collection%3CD%3E coll) %7B%0A        if (coll == null) %7B%0A            throw new IllegalArgumentException(%22Collection must not be null%22);%0A        %7D%0A        this.collection = coll;%0A    %7D%0A%0A
     /**%0A    

add constructor that sets the member field, but may remove class as it is unused.