code: public void set(int row, int col, double val) {
          checkIndices(row, col, true);
          Entry e = new Entry(row, col);
          // Spin waiting for the entry to be unlocked
          while (lockedEntries.putIfAbsent(e, new Object()) != null)
              ;
          boolean present = matrixEntries.containsKey(e);
          if (val != 0) {
              matrixEntries.put(e, val);
              // Only invalidate the cache if the number of rows or columns
              // containing data has changed
              if (!present)
                  modifications.incrementAndGet();
          }
          else if (present) {
              matrixEntries.remove(e);
              modifications.incrementAndGet();
          }
  
          lockedEntries.remove(e);
      }
docs: {@inheritDoc}