Browse Source

added clear()

Nicolas Cannasse 19 years ago
parent
commit
e70b6cc4b7
1 changed files with 8 additions and 0 deletions
  1. 8 0
      std/List.hx

+ 8 - 0
std/List.hx

@@ -117,6 +117,14 @@ class List<T> {
 		return (h == null);
 	}
 
+	/**
+		Makes the list empty.
+	**/
+	public function clear() : Void {
+		h = null;
+		length = 0;
+	}
+
 	/**
 		Remove the first element that is [== v] from the list.
 		Returns [true] if an element was removed, [false] otherwise.