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

Method resize

core/src/processing/data/StringDict.java:145–161  ·  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

143 * Helpful for situations like sorting and then grabbing the top 50 entries.
144 */
145 public void resize(int length) {
146 if (length > count) {
147 throw new IllegalArgumentException("resize() can only be used to shrink the dictionary");
148 }
149 if (length < 1) {
150 throw new IllegalArgumentException("resize(" + length + ") is too small, use 1 or higher");
151 }
152
153 String[] newKeys = new String[length];
154 String[] newValues = new String[length];
155 PApplet.arrayCopy(keys, newKeys, length);
156 PApplet.arrayCopy(values, newValues, length);
157 keys = newKeys;
158 values = newValues;
159 count = length;
160 resetIndices();
161 }
162
163
164 /**

Callers

nothing calls this directly

Calls 2

arrayCopyMethod · 0.95
resetIndicesMethod · 0.95

Tested by

no test coverage detected