/// <summary>
        /// Executes a given callback passing each element of the specified row. The callback
        /// receives the element together with its coordinates. <BR>
        /// Callbacks are executed synchronously before the method returns: calling
        /// insert or delete methods during callback execution may result in
        /// a wrong iteration, return false from the callback to remove the current element.
        /// </summary>
        public virtual void forEachElementInRow(R row, ElementCallback <R, C, string> callback)
        {
            ConcurrentDictionary <C, string> rowElements;

            matrix.TryGetValue(row, out rowElements);
            if (rowElements == null)
            {
                return;
            }

            IEnumerator <KeyValuePair <C, string> > iterator = rowElements.SetOfKeyValuePairs().GetEnumerator();

            while (iterator.MoveNext())
            {
                KeyValuePair <C, string> entry = iterator.Current;
                string value = entry.Value;
                if (string.ReferenceEquals(value, NULL))
                {
                    value = null;
                }
                bool remove = callback.onElement(value, row, entry.Key);
                if (remove)
                {
                    rowElements.SetOfKeyValuePairs().Remove(entry);
                }
            }

            if (rowElements.IsEmpty)
            {
                this.matrix.TryRemove(row, out t);
            }
        }
        /// <summary>
        /// Executes a given callback passing each element of the specified row. The callback
        /// receives the element together with its coordinates. <BR>
        /// Callbacks are executed synchronously before the method returns: calling
        /// insert or delete methods during callback execution may result in
        /// a wrong iteration, return false from the callback to remove the current element.
        /// </summary>
        public virtual void forEachElementInRow(R row, ElementCallback <R, C, V> callback)
        {
            ConcurrentDictionary <C, V> rowElements;

            matrix.TryGetValue(row, out rowElements);
            if (rowElements == null)
            {
                return;
            }

            IEnumerator <KeyValuePair <C, V> > iterator = rowElements.SetOfKeyValuePairs().GetEnumerator();

            while (iterator.MoveNext())
            {
                KeyValuePair <C, V> entry = iterator.Current;
                bool remove = callback.onElement(entry.Value, row, entry.Key);
                if (remove)
                {
                    rowElements.SetOfKeyValuePairs().Remove(entry);
                }
            }

            if (rowElements.Count == 0)
            {
                ConcurrentDictionary <C, V> rowMap;
                this.matrix.TryRemove(row, out rowMap);
            }
        }
 /// <summary>
 /// Executes a given callback passing each element of the Matrix. The callback
 /// receives the element together with its coordinates. <BR>
 /// Callbacks are executed synchronously before the method returns: calling
 /// insert or delete methods during callback execution may result in
 /// a wrong iteration, return false from the callback to remove the current element.
 /// </summary>
 public virtual void forEachElement(ElementCallback <R, C, V> callback)
 {
     foreach (R row in this.matrix.Keys)
     {
         this.forEachElementInRow(row, callback);
     }
 }
 /// <summary>
 /// Executes a given callback passing each element of the Matrix. The callback
 /// receives the element together with its coordinates. <BR>
 /// Callbacks are executed synchronously before the method returns: calling
 /// insert or delete methods during callback execution may result in
 /// a wrong iteration, return false from the callback to remove the current element.
 /// </summary>
 public virtual void forEachElement(ElementCallback <R, C, string> callback)
 {
     //Iterator<String> iterator = list.iterator(); iterator.hasNext();
     foreach (R row in this.matrix.Keys)
     {
         this.forEachElementInRow(row, callback);
     }
 }