package org.psjava.ds.array;

import java.util.Iterator;


public class MutableSubArray {
	public static <T> MutableArray<T> create(final MutableArray<T> original, final int start, final int size) {
		return new MutableArray<T>() {
			@Override
			public T get(int index) {
				return original.get(start + index);
			}
			@Override
			public void set(int index, T value) {
				original.set(start + index, value);				
			}
			@Override
			public boolean isEmpty() {
				return size == 0;
			}
			@Override
			public Iterator<T> iterator() {
				return ArrayIterator.create(this);
			}
			@Override
			public int size() {
				return size;
			}			
		};
	}
}

@@ -55,16 +55,62 @@
 tor;%0D%0A%0D%0A
+import org.psjava.javautil.IterableToString;%0D%0A
 %0D%0Apublic
@@ -707,19 +707,114 @@
 e;%0D%0A%09%09%09%7D
-%09%09%09
+%0D%0A%0D%0A%09%09%09@Override%0D%0A%09%09%09public String toString() %7B%0D%0A%09%09%09%09return IterableToString.toString(this);%0D%0A%09%09%09%7D
 %0D%0A%09%09%7D;%0D%0A

add tostring method for debugging