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

Method resize

core/src/processing/data/FloatDict.java:123–141  ·  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

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

Callers

nothing calls this directly

Calls 2

arrayCopyMethod · 0.95
resetIndicesMethod · 0.95

Tested by

no test coverage detected