Writing bug free data structure implementations is hard. Doing it in a way that is highly performant is extremely hard.
The idea of cutting/pasting code seems pretty backwards to me compared to just using one of these libraries:
http://java-performance.info/large-hashmap-overview-jdk-fast...