|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
F - the concrete factory type which extends this interfacepublic interface ObjHashFactory<F extends ObjHashFactory<F>>
Common configuration for factories of hash containers with Object keys.
Currently ObjHashFactory allows to specify only if null key is allowed
or disallowed in hash containers, constructed by the factory. This is a performance hint:
hash containers might, but aren't required to throw NullPointerException on putting
null key, if null key is disallowed.
By default, null key is disallowed. Because in 99% of cases null
key isn't possible (moreover, it is a bad practice to use null along with ordinary
objects), on the other side, when null key is disallowed, substantial optimizations
of hash table implementations become possible.
To construct hash containers which strictly follow HashMap
and HashSet behaviour (these collections support null keys), you
must configure the corresponding factory to allow null keys:
factory = factory.withNullKeyAllowed(true);
Koloboke Compile's counterpart of the withNullKeyAllowed() configuration is the @NullKeyAllowed annotation. An important difference is that ObjHashFactory doesn't guarantee that constructed containers throws NullPointerException
to enforce the null key disallowance in runtime, while @NullKeyAllowed does
guarantee that.
| Method Summary | |
|---|---|
boolean |
isNullKeyAllowed()
Returns true if null key is allowed, false otherwise. |
F |
withNullKeyAllowed(boolean nullKeyAllowed)
Returns a copy of this factory with null key allowed or disallowed, as specified. |
| Methods inherited from interface com.koloboke.collect.hash.HashContainerFactory |
|---|
getHashConfig, withHashConfig |
| Methods inherited from interface com.koloboke.collect.ContainerFactory |
|---|
getDefaultExpectedSize, withDefaultExpectedSize |
| Method Detail |
|---|
boolean isNullKeyAllowed()
true if null key is allowed, false otherwise.
Default: false.
true if null key is allowed, false otherwiseF withNullKeyAllowed(boolean nullKeyAllowed)
null key allowed or disallowed, as specified.
This is a performance hint: hash containers might, but aren't required to throw
NullPointerException on putting null key, if null key is disallowed.
nullKeyAllowed - if null should be allowed in the containers contructed
by the returned factory
null key allowed or disallowed, as specified
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||