The interface TransferQueue
has been added. It is a refinement of the BlockingQueue
interface in which producers can wait for consumers to receive elements. One implementation of the new interface is also included in this release, LinkedTransferQueue
.
Java SE 7u6 introduces an improved, alternative hash function for the following map and map-derived collection implementations:
The alternative hash function improves the performance of these map implementations when a large number of key hash collisions are encountered.
For Java SE 7u6, this alternative hash function is implemented as follows:
The alternative hash function is only applied to keys of type String
.
The alternative hash function is only applied to maps with a capacity larger than a specified threshold size. By default, the threshold is -1
. This value disables the alternative hash function. To enable the alternative hash function (which is only applied to keys of type String
), set the jdk.map.althashing.threshold
system property to a different value. The recommended value is 512
. Setting this system property to 512
causes all maps with a capacity larger than 512 entries to use the alternative hash function. You can set this system property to 0
, which causes all maps to use the alternative hash function.
The following describes the jdk.map.althashing.threshold
system property in more detail:
-1
String
. The value -1
is a synonym for 2147483647
(which is easier to remember). All other values correspond to threshold capacity.For example, the following command runs the Java application MyApplication
and sets the jdk.map.althashing.threshold
system property to 512
:
java -Djdk.map.althashing.threshold=512 MyApplication
If the alternative hash function is being used, then the iteration order of keys, values, and entities vary for each instance of HashMap
, Hashtable
, HashSet
, and ConcurrentHashMap
. This change in iteration order may cause compatibility issues with some programs. This is the reason that the alternative hash function is disabled by default. Future Java SE versions and releases will probably enable the alternative hash function for keys of type String
by default. If you are concerned about application performance or compatibility with future versions of Java SE, you should enable the alternative hash function when testing your applications.