소스 검색

added clear()

Nicolas Cannasse 19 년 전
부모
커밋
e70b6cc4b7
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  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.