code: public void set(int index, T value) {
          // If we are setting a non-null value, then always add it to the array
          if (value != null) {
              // Check whether the put call actually modified the map, and if so
              // invalidate any previous set of indices;
              if (indexToValue.put(index, value) == null)
                  indices = null;
          }
          // Otherwise, check whether an existing element was there and if so,
          // remove that index from the array, thereby maintaining sparseness.
          else if (indexToValue.remove(index) != null) {                
              // Since we removed something from the map, invalidate the
              // memoized indices
              indices = null;
          }
      }
docs: {@inheritDoc}