src/main/java/org/jboss/util/Heap.java
public void insert(Object obj)
   {
      int length = m_nodes.length;
      // Expand if necessary
      if (m_count == length)
      {
         Object[] newNodes = new Object[length + length];
         System.arraycopy(m_nodes, 0, newNodes, 0, length);
         m_nodes = newNodes;
      }
      // Be cur_slot the first unused slot index; be par_slot its parent index.
      // Start from cur_slot and walk up the tree comparing the object to 
      // insert with the object at par_slot; if it's smaller move down the object at par_slot,
      // otherwise cur_slot is the index where insert the object. If not done, 
      // shift up the tree so that now cur_slot is the old par_slot and 
      // par_slot is the parent index of the new cur_slot (so the grand-parent
      // index of the old cur_slot) and compare again.
      int k = m_count;
      while (k > 0)
      {
         int par = parent(k);
         if (compare(obj, m_nodes[par]) < 0)
         {
            m_nodes[k] = m_nodes[par];
            k = par;
         }
         else break;
      }
      m_nodes[k] = obj;
      ++m_count;
   }
public void insert(Object obj)
   {
      int length = m_nodes.length;
      // Expand if necessary
      if (m_count == length)
      {
         Object[] newNodes = new Object[length + length];
         System.arraycopy(m_nodes, 0, newNodes, 0, length);
         m_nodes = newNodes;
      }
      // Be cur_slot the first unused slot index; be par_slot its parent index.
      // Start from cur_slot and walk up the tree comparing the object to 
      // insert with the object at par_slot; if it's smaller move down the object at par_slot,
      // otherwise cur_slot is the index where insert the object. If not done, 
      // shift up the tree so that now cur_slot is the old par_slot and 
      // par_slot is the parent index of the new cur_slot (so the grand-parent
      // index of the old cur_slot) and compare again.
      int k = m_count;
      while (k > 0)
      {
         int par = parent(k);
         if (compare(obj, m_nodes[par]) < 0)
         {
            m_nodes[k] = m_nodes[par];
            k = par;
         }
         else break;
      }
      m_nodes[k] = obj;
      ++m_count;
   }
public void insert ( Object obj ) { int length = m_nodes . length ; // Expand if necessary if ( m_count == length ) { Object [ ] newNodes = new Object [ length + length ] ; System . arraycopy ( m_nodes , 0 , newNodes , 0 , length ) ; m_nodes = newNodes ; } // Be cur_slot the first unused slot index; be par_slot its parent index. // Start from cur_slot and walk up the tree comparing the object to  // insert with the object at par_slot; if it's smaller move down the object at par_slot, // otherwise cur_slot is the index where insert the object. If not done,  // shift up the tree so that now cur_slot is the old par_slot and  // par_slot is the parent index of the new cur_slot (so the grand-parent // index of the old cur_slot) and compare again. int k = m_count ; while ( k > 0 ) { int par = parent ( k ) ; if ( compare ( obj , m_nodes [ par ] ) < 0 ) { m_nodes [ k ] = m_nodes [ par ] ; k = par ; } else break ; } m_nodes [ k ] = obj ; ++ m_count ; }
Inserts the given element in this heap.
@param obj

@see #extract
Inserts the given element in this heap . @param obj