sizeToBePlused = keySize + valueSize;
}
// throw exception if size of key/value pair is even larger than the max capacity
if (keySize + valueSize > sizeBoundaryInBytes) {
throw new SizeTooLargeException("required=" + sizeToBePlused + "; max capacity=" + sizeBoundaryInBytes);
}
// shortcut for key/value pair whose size equals to the max capacity
if (keySize + valueSize == sizeBoundaryInBytes) {
map.clear();
retainedSizeInBytes = sizeBoundaryInBytes;