@Override
   public E set(int index, E element) {
      E tempValue = null;
      if (this.currentSize >= this.arrays.length) {
         //increase the length of array to index
         this.arrays = Arrays.copyOf(this.arrays, this.arrays.length + (this.currentSize >> 1));
      }
      
      if (index < 0 || index > this.currentSize) {
         return null;
      }
      
      tempValue = this.get(index);
      this.arrays[index] = element;
      if (null == tempValue) {
         this.currentSize++;
      }
      return tempValue;
   }