public T put( int key, T value )
   {
      if (size == 0)
      {
         putFirst( key, value );

         return null;
      }

      T previousValue = null;
      final int i = relativeIndex( key );

      if (i < 0)
      {
         prepend( -i );
         values[0] = value;
         min = key;
         size++;
      }
      else if (i >= values.length)
      {
         resize( i + 1 );
         values[i] = value;
         size++;
      }
      else
      {
         previousValue = values[i];

         if (previousValue == null)
         {
            size++;
         }

         values[i] = value;
      }

      return previousValue;
   }