MCPcopy Create free account
hub / github.com/benfry/processing4 / remove

Method remove

core/src/processing/data/LongList.java:226–243  ·  view source on GitHub ↗

Remove an element from the specified index @webref intlist:method @webBrief Remove an element from the specified index

(int index)

Source from the content-addressed store, hash-verified

224 * @webBrief Remove an element from the specified index
225 */
226 public long remove(int index) {
227 if (index < 0 || index >= count) {
228 throw new ArrayIndexOutOfBoundsException(index);
229 }
230 long entry = data[index];
231// int[] outgoing = new int[count - 1];
232// System.arraycopy(data, 0, outgoing, 0, index);
233// count--;
234// System.arraycopy(data, index + 1, outgoing, 0, count - index);
235// data = outgoing;
236 // For most cases, this actually appears to be faster
237 // than arraycopy() on an array copying into itself.
238 for (int i = index; i < count-1; i++) {
239 data[i] = data[i+1];
240 }
241 count--;
242 return entry;
243 }
244
245
246 // Remove the first instance of a particular value,

Callers 2

removeValueMethod · 0.95
removeChoiceMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected