code: public void add(int index, Object element)
      {
          DListEntry entry = prepareEntry(element);
          elements.add(index, entry);
          // if we are in a transaction: acquire locks !
          TransactionImpl tx = getTransaction();
          if (checkForOpenTransaction(tx))
          {
              RuntimeObject rt = new RuntimeObject(this, tx);
              List regList = tx.getRegistrationList();
              tx.lockAndRegister(rt, Transaction.WRITE, false, regList);
  
              rt = new RuntimeObject(element, tx);
              tx.lockAndRegister(rt, Transaction.READ, regList);
  
              rt = new RuntimeObject(entry, tx, true);
              tx.lockAndRegister(rt, Transaction.WRITE, false, regList);
          }
  
          // changing the position markers of entries:
          int offset = 0;
          try
          {
              offset = ((DListEntry) elements.get(index - 1)).getPosition();
          }
          catch (Exception ignored)
          {
          }
          for (int i = offset; i < elements.size(); i++)
          {
              entry = (DListEntry) elements.get(i);
              entry.setPosition(i);
          }
      }
docs: Inserts the specified element at the specified position in this list
  (optional operation).  Shifts the element currently at that position
  (if any) and any subsequent elements to the right (adds one to their
  indices).
  
  @param index index at which the specified element is to be inserted.
  @param element element to be inserted.
  
  @throws UnsupportedOperationException if the <tt>add</tt> method is not
  supported by this list.
  @throws    ClassCastException if the class of the specified element
  prevents it from being added to this list.
  @throws    IllegalArgumentException if some aspect of the specified
  element prevents it from being added to this list.
  @throws    IndexOutOfBoundsException if the index is out of range
  (index &lt; 0 || index &gt; size()).