to clear array-list (#18818)

* to clear array-list

* Update index.md
This commit is contained in:
vikash vaibhav
2018-10-16 02:46:53 +05:30
committed by Quincy Larson
parent c31aa711d6
commit 2379d56b38

View File

@@ -28,6 +28,11 @@ Since ArrayList implements *List*, an ArrayList can be created using the followi
An ArrayList is dynamic, meaning it will grow in size if required and similarly shrink in size if elements are deleted from it. This is what makes it better to use than normal arrays. An ArrayList is dynamic, meaning it will grow in size if required and similarly shrink in size if elements are deleted from it. This is what makes it better to use than normal arrays.
To clear/delete all elements from ArrayList
```java
variable.clear();
```
we can delete existing element from the list we can delete existing element from the list
```java ```java
variable_name.remove(index_number); variable_name.remove(index_number);