Set the entry at a particular index. If the index is past the length of the list, it'll expand the list to accommodate, and fill the intermediate entries with 0s. @webref floatlist:method @brief Set the entry at a particular index
(int index, float what)
| 166 | * @brief Set the entry at a particular index |
| 167 | */ |
| 168 | public void set(int index, float what) { |
| 169 | if (index >= count) { |
| 170 | data = PApplet.expand(data, index+1); |
| 171 | for (int i = count; i < index; i++) { |
| 172 | data[i] = 0; |
| 173 | } |
| 174 | count = index+1; |
| 175 | } |
| 176 | data[index] = what; |
| 177 | } |
| 178 | |
| 179 | |
| 180 | /** Just an alias for append(), but matches pop() */ |
no test coverage detected