HHH-13645 Include a comment in the implementation about the design choice to not optimise for null values
This commit is contained in:
parent
00d25c1824
commit
a92cd6c9b9
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.stat.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.function.Function;
|
||||
|
@ -71,6 +69,10 @@ final class StatsNamedContainer<V> {
|
|||
}
|
||||
else {
|
||||
final V v2 = function.apply( key );
|
||||
//Occasionally a function might return null. We can't store a null in the CHM,
|
||||
// so a placeholder would be required to implement that, but we prefer to just keep this
|
||||
// situation as slightly sub-optimal so to not make the code more complex just to handle the exceptional case:
|
||||
// null values are assumed to be rare enough for this not being worth it.
|
||||
if ( v2 == null ) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue