Top.Mail.Ru
September 12th, 2001 - Java developers — LiveJournal
? ?

Java developers

September 12th, 2001

03:35 pm - banana - That String class again

The Java String class is final, so I can't extend it. Anyone know why?

The reason I noticed this was that I wanted to make a subclass of String and over ride hashCode() and equals() so that I could have a Properties that was case in-sensitive.

If it worked, when I called getProperty() and setProperty(), keys that only differed in case would be the same.

Anyone got another way to do this? I want to use Properties because it's got quick (hashing) lookups, and feeding it my String subclass would have been the business. My first attempt was to write my own Properties-like class, but it had slow lookups (testing against every key) - bleargh!

Powered by LiveJournal.com