hotspot/src/share/vm/utilities/growableArray.hpp
changeset 4450 6d700b859b3e
parent 1623 a0dd9009e992
child 5547 f4b087cbb361
--- a/hotspot/src/share/vm/utilities/growableArray.hpp	Fri Nov 27 07:56:58 2009 -0800
+++ b/hotspot/src/share/vm/utilities/growableArray.hpp	Thu Nov 12 09:24:21 2009 -0800
@@ -278,6 +278,17 @@
     _len--;
   }
 
+  // inserts the given element before the element at index i
+  void insert_before(const int idx, const E& elem) {
+    check_nesting();
+    if (_len == _max) grow(_len);
+    for (int j = _len - 1; j >= idx; j--) {
+      _data[j + 1] = _data[j];
+    }
+    _len++;
+    _data[idx] = elem;
+  }
+
   void appendAll(const GrowableArray<E>* l) {
     for (int i = 0; i < l->_len; i++) {
       raw_at_put_grow(_len, l->_data[i], 0);