src/share/vm/utilities/growableArray.hpp

changeset 7041
411e30e5fbb8
parent 7028
46bbe04d1cad
child 7535
7ae4e26cb1e0
child 9858
b985cbb00e68
equal deleted inserted replaced
7040:da00a41842a5 7041:411e30e5fbb8
347 } 347 }
348 } 348 }
349 349
350 // inserts the given element before the element at index i 350 // inserts the given element before the element at index i
351 void insert_before(const int idx, const E& elem) { 351 void insert_before(const int idx, const E& elem) {
352 assert(0 <= idx && idx <= _len, "illegal index");
352 check_nesting(); 353 check_nesting();
353 if (_len == _max) grow(_len); 354 if (_len == _max) grow(_len);
354 for (int j = _len - 1; j >= idx; j--) { 355 for (int j = _len - 1; j >= idx; j--) {
355 _data[j + 1] = _data[j]; 356 _data[j + 1] = _data[j];
356 } 357 }
358 _data[idx] = elem; 359 _data[idx] = elem;
359 } 360 }
360 361
361 void appendAll(const GrowableArray<E>* l) { 362 void appendAll(const GrowableArray<E>* l) {
362 for (int i = 0; i < l->_len; i++) { 363 for (int i = 0; i < l->_len; i++) {
363 raw_at_put_grow(_len, l->_data[i], 0); 364 raw_at_put_grow(_len, l->_data[i], E());
364 } 365 }
365 } 366 }
366 367
367 void sort(int f(E*,E*)) { 368 void sort(int f(E*,E*)) {
368 qsort(_data, length(), sizeof(E), (_sort_Fn)f); 369 qsort(_data, length(), sizeof(E), (_sort_Fn)f);

mercurial