+2009-01-27 Jürg Billeter <j@bitron.ch>
+
+ * gee/arraylist.vala:
+ * gee/list.vala:
+ * gee/readonlylist.vala:
+
+ Add List.slice method, patch by Zeeshan Ali Khattak,
+ fixes bug 569188
+
2008-11-01 Jürg Billeter <j@bitron.ch>
* configure.ac: Post-release version bump
_stamp++;
}
+ public List<G>? slice (int start, int stop) {
+ return_val_if_fail (start <= stop, null);
+ return_val_if_fail (start >= 0, null);
+ return_val_if_fail (stop <= this.size, null);
+
+ var slice = new ArrayList<G> (this._equal_func);
+ for (int i = start; i < stop; i++) {
+ slice.add (this[i]);
+ }
+
+ return slice;
+ }
+
private void shift (int start, int delta) {
assert (start >= 0 && start <= _size && start >= -delta);
* @param index zero-based index of the item to be removed
*/
public abstract void remove_at (int index);
+
+ /**
+ * Returns a slice of this list.
+ *
+ * @param start zero-based index of the begin of the slice
+ * @param stop zero-based index after the end of the slice
+ *
+ * @return A list containing a slice of this list
+ */
+ public abstract List<G>? slice (int start, int stop);
}
assert_not_reached ();
}
+ public List<G>? slice (int start, int stop) {
+ assert_not_reached ();
+ }
+
class Iterator<G> : Object, Gee.Iterator<G> {
public bool next () {
return false;