Alex,<div><br></div><div>Might I suggest you look at the test framework in <a href="http://code.google.com/p/google-collections/" target="_blank">Google Collections</a>? Extremely good coverage and only a couple of lines to set up.<div>

<br></div><div>Tests for maps in java.util: <a href="http://www.google.com/codesearch/p?hl=en#YXcrkXezIpQ/trunk/testfw/com/google/common/collect/testing/TestsForMapsInJavaUtil.java" target="_blank">http://www.google.com/codesearch/p?hl=en#YXcrkXezIpQ/trunk/testfw/com/google/common/collect/testing/TestsForMapsInJavaUtil.java</a></div>


<div><a href="http://www.google.com/codesearch/p?hl=en#YXcrkXezIpQ/trunk/testfw/com/google/common/collect/testing/TestsForMapsInJavaUtil.java" target="_blank"></a>See for example line 118.</div><div><br></div><div>Thanks,</div>

<div>Joe<br><br><div class="gmail_quote">2009/6/6 Alex Yakovlev <span dir="ltr"><<a href="mailto:alex14n@gmail.com" target="_blank">alex14n@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Doug,<br><br>I've finished HashMap, HashSet, LinkedHashMap, and LinkedHashSet<br>porting to my approach. I run several tests I've found in jdk/test/java/util/*<br>


that are directly related to these classes, not sure I've found all of them.<br>
<br>I have not compiled the whole jdk classes - only these 4 (removed 'Fast'<br>prefix from names and put them into java.util package) and replaced<br>those in my rt.jar of binary jdk7b59. Applications like Eclipse and Tomcat<br>



are running fine.<br><br>Are there any thorough regression/compliance tests for java collections?<br><br><div class="gmail_quote"><div>On Thu, Jun 4, 2009 at 4:32 PM, Doug Lea <span dir="ltr"><<a href="mailto:dl@cs.oswego.edu" target="_blank">dl@cs.oswego.edu</a>></span> wrote:<br>



</div><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex"><div>Alex Yakovlev wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">

While playing with scala programming language I've come toa HashMap implementation<div><br>
that appears to be faster than current java.util.HashMap, also with a lower memory footprint.<br>

</div></blockquote>
<br></div><div>
This is a promising approach. The indirection using the<br>
index array makes for a better time/space tradeoff than<br>
current HashMap for many usages.<br>
<br>
There are however a couple of constraints on HashMap<br>
that have made it difficult to replace it with<br>
overhauled internals, despite a few explorations in<br>
doing so.<br>
<br>
The main one is that LinkedHashMap is declared as a<br>
subclass of HashMap. There's not<br>
an obvious way to add insertion- or access- ordered links<br>
to your version. This still might not be a huge obstacle,<br>
since with some care, and some wastage, LinkedHashMap<br>
could ignore its superclass implementation and re-establish<br>
current approach.<br>
<br>
Also, the meaning/impact of load-factor parameters differs<br>
in your version. It seems possible to reinterpret these internally<br>
to provide approximately equivalent statistical properties.<br>
(For example a loadFactor argument of 2.0 might translate into<br>
internal one of around 0.9.)<br>
<br></div><div>

Across such issues, it would take some further work to<br>
make a strong case for actually replacing HashMap.<br></div></blockquote></div><br>
</blockquote></div><br></div>
</div>