Explorar o código

added clear()

Nicolas Cannasse %!s(int64=19) %!d(string=hai) anos
pai
achega
e70b6cc4b7
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  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.