March 2019
Intermediate to advanced
336 pages
9h 9m
English
The NumberOfElements method of the Dictionary class returns the length of the elements map. The RLock method of the lock instance is invoked. The RUnlock method of the lock instance is deferred before returning the length; this is shown in the following code snippet:
// NumberOfElements methodfunc (dict *Dictionary) NumberOfElements() int { dict.lock.RLock() defer dict.lock.RUnlock() return len(dict.elements)}
Read now
Unlock full access