The curious case of Java String HashCode

Introduction

I have been programming in Java since the past 1.5 years. Recently, I was experimenting with performance analysis of Java Data structures. To get my hands dirty, I decided to play around with my favourite data structure i.e HashSet. HashSet provides an O(1) lookup and inserts time. I measured & compared the time taken to lookup random strings having different sizes in a…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store