There are multiple ways to delete an element from an ArrayBuffer. Let’s look at the ones which are most commonly used.
For all the examples below, we will be working with newArrayBuff. Remember that our original ArrayBuffer contains the elements
[
6
,
15
,
78
,
4
,
32
,
11
]
[6,15,78,4,32,11]
.
-= Assignment Operator
The same way we add an element using +=, we can remove a specific element using -=.