@@ -0,0 +1,690 @@
+package org.psjava.ds.array;%0A%0Aimport java.util.Iterator;%0A%0Aimport org.psjava.javautil.IterableToString;%0A%0Apublic class SubArray %7B%0A%0A%09public static %3CT%3E Array%3CT%3E create(final Array%3CT%3E original, final int start, final int end) %7B%0A%09%09return new Array%3CT%3E() %7B%0A%09%09%09@Override%0A%09%09%09public T get(int index) %7B%0A%09%09%09%09return original.get(start + index);%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public int size() %7B%0A%09%09%09%09return end - start;%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public final boolean isEmpty() %7B%0A%09%09%09%09return size() == 0;%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public final Iterator%3CT%3E iterator() %7B%0A%09%09%09%09return ArrayIterator.create(this);%0A%09%09%09%7D%0A%0A%09%09%09@Override%0A%09%09%09public final String toString() %7B%0A%09%09%09%09return IterableToString.toString(this);%0A%09%09%09%7D%0A%09%09%7D;%0A%09%7D%0A%0A%7D%0A

add sub array class