locked
Possible bug Notepad windows 10 RRS feed

  • Question

  • Firstly: I was told "Your concern regarding the possible bug that you came across while working with Hash Maps in Java is best being handled in MSDN forums." by the Microsoft forum mods since this bug is related to Notepad and java. I originally thought to post there because of it being related to Notepad. Let me know if I'm in the wrong place.

    The problem:

    Recently I was coding some java for work and I came across something rather strange. I had two identical numbers that were on two lines of text I had copied from an excel spreadsheet into notepad to work with as data. I was working with hash maps and I compared these strings as the keys to said hash maps using the 'Hashmap.containsKey' method. This should return true if the keys are the same. Both keys were a string, the number "01002". However, I found out that it was returned false. I looked at the hash of both strings in java and I looked at the bit encoding and to my surprise they were different. I had no idea how this could happen because they came from the same place and had the same format. I thought maybe if I put the line that had this string in it down the file and not at the very top that that might work. Surprisingly it did and what's more, I purposely put another matching string up on the top line and the same error occurred again this time with the string "00504". When I removed this string from the top line of the file, java said the strings were the same, but if the string was at the top of the file it was always different from any other identical strings anywhere else in the file. I was wondering if this was a bug, maybe I'm just blind or what but it really confused me why the Strings would be marked as different based upon their position in the file. Explanation is greatly appreciated sorry for the technical and long question. I couldn't find any other good place to ask about Notepad stuff. People only seem to care about Notepad++

    Friday, June 22, 2018 12:05 PM

Answers