Combined two sentences (#25706)
This commit is contained in:
@ -84,6 +84,7 @@ Since ArrayList implements *List*, an ArrayList can be created using the followi
|
|||||||
Collections.sort(variable_name, Collections.reverseOrder());
|
Collections.sort(variable_name, Collections.reverseOrder());
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
**Creating Array from ArrayList**
|
**Creating Array from ArrayList**
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@ -98,7 +99,8 @@ for(Object obj : arr) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
An ArrayList allows us to randomly access elements. ArrayList is similar to *Vector* in a lot of ways. But it is faster than Vectors. The main thing to note is that - Vectors are faster than arrays but ArrayLists are not.
|
An ArrayList allows us to randomly access elements. ArrayList is similar to *Vector* in a lot of ways, but it is faster than Vectors. The main thing to note is that - Vectors are faster than arrays but ArrayLists are not.
|
||||||
|
|
||||||
|
|
||||||
So when it comes down to choosing between the two - if speed is critical then Vectors should be considered, otherwise ArrayLists are better when it comes to storing large number of elements and accessing them efficiently.
|
So when it comes down to choosing between the two - if speed is critical then Vectors should be considered, otherwise ArrayLists are better when it comes to storing large number of elements and accessing them efficiently.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user