package clarity.match;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import com.rits.cloning.Cloner;

public class GenericCollection<T> implements Cloneable {
    
    private static final Cloner CLONER = new Cloner();
    
    private final List<T> values = new ArrayList<T>();

    public void add(T value) {
        values.add(value);
    }
    
    public void clear() {
        values.clear();
    }
    
    public List<T> getAll() {
        return Collections.unmodifiableList(values);
    }
    
    @Override
    public Object clone() {
       return CLONER.deepClone(this);
    }
    
}

@@ -79,16 +79,44 @@
 tions;%0D%0A
+import java.util.Iterator;%0D%0A
 import j
@@ -212,16 +212,29 @@
 plements
+ Iterable%3CT%3E,
  Cloneab
@@ -686,22 +686,118 @@
 is);%0D%0A    %7D%0D
+%0A%0D%0A    @Override%0D%0A    public Iterator%3CT%3E iterator() %7B%0D%0A        return values.iterator();%0D%0A    %7D%0D
 %0A    %0D%0A%7D%0D%0A

make GenericCollection iterable