package org.drpowell.vcf;

import java.util.AbstractCollection;
import java.util.ArrayList;
import java.util.Iterator;

public class VCFMemoryCollection extends AbstractCollection<VCFVariant> {
	private final ArrayList<VCFVariant> variants = new ArrayList<VCFVariant>();
	private VCFHeaders headers;
	
	public VCFMemoryCollection(VCFParser parser) {
		for (VCFVariant v: parser) {
			variants.add(v);
		}
		headers = parser.getHeaders();
	}
	
	public VCFHeaders getHeaders() {
		return headers;
	}

	@Override
	public Iterator<VCFVariant> iterator() {
		return variants.iterator();
	}

	@Override
	public int size() {
		return variants.size();
	}

}

@@ -45,26 +45,20 @@
 Abstract
-Collection
+List
 ;%0Aimport
@@ -156,26 +156,20 @@
 Abstract
-Collection
+List
 %3CVCFVari
@@ -629,10 +629,91 @@
 ();%0A%09%7D%0A%0A
+%09@Override%0A%09public VCFVariant get(int index) %7B%0A%09%09return variants.get(index);%0A%09%7D%0A%0A
 %7D%0A

implement list instead of collection for random access