MCPcopy Index your code
hub / github.com/processing/processing / resize

Method resize

core/src/processing/data/LongDict.java:124–140  ·  view source on GitHub ↗

Resize the internal data, this can only be used to shrink the list. Helpful for situations like sorting and then grabbing the top 50 entries.

(int length)

Source from the content-addressed store, hash-verified

122 * Helpful for situations like sorting and then grabbing the top 50 entries.
123 */
124 public void resize(int length) {
125 if (length > count) {
126 throw new IllegalArgumentException("resize() can only be used to shrink the dictionary");
127 }
128 if (length < 1) {
129 throw new IllegalArgumentException("resize(" + length + ") is too small, use 1 or higher");
130 }
131
132 String[] newKeys = new String[length];
133 long[] newValues = new long[length];
134 PApplet.arrayCopy(keys, newKeys, length);
135 PApplet.arrayCopy(values, newValues, length);
136 keys = newKeys;
137 values = newValues;
138 count = length;
139 resetIndices();
140 }
141
142
143 /**

Callers

nothing calls this directly

Calls 2

arrayCopyMethod · 0.95
resetIndicesMethod · 0.95

Tested by

no test coverage detected