Friday, March 18, 2016

Omio Bani


  1. http://stackoverflow.com/questions/36069596/java-how-to-convert-string-to-string-with-different-charset


A string doesn't have an encoding - or it's always UTF-16, if you want to think of it like that. There's no such thing as "a UTF8 string". If you've converted some binary data into a String using the wrong encoding, you're in trouble already


  1. http://stackoverflow.com/questions/36063803/why-the-containvalue-method-returning-true-even-if-i-override-the-hashcode-met

Hash maps only use hash codes to find keys efficiently. When you ask the map to find a value, it basically has to iterate over all its entries, at which point there's no point in using hashCode(), so it just calls equals.
If you try the map the other way round, with Test as the key instead of the value, that won't work without overriding hashCode.

No comments:

Post a Comment