I have a very unusual problem.
Basically, I am trying to get the value associated with a key from a string map to strings.
I know that the key that I use is present; I use the same line that I used to enter it!
I print statements all over my code, and this is the case when I have ... Here is my characterDictionary
{thusChar=∴, spaceChar= , plusChar=+, equalsIndent=
The most recent "variableIndent" key is the problem!
Here is the code ...
System.out.println ( characterDictionary.get("variableIndent") );
which incorrectly displays: null
I checked, double checked and tripled my code.
There is no difference between the "variableIndent" key and the string argument characterDictionary.get("variableIndent"), but it behaves as if this key were missing.
I can guarantee that this key is present, and that the two lines are identical.
All other elements (those that I checked, about 3 so far) of the dictionary are extracted as usual. Why does "variableIndent" play with the value "@" with it?
You may notice that the dictionary contains non-ASCII characters, such as "thatChar". Could this be related?
Thanks
(This seems like a very simple and trivial problem, as if I made some kind of pathetic stupid mistake, but still I just can't solve it!)
EDIT:
, - .
get.
, java , .
UTF-8, java Eclipse.
.
?
!
EDIT:
, .
UTF-8, ...
variableIndent,@
equalsIndent,
spaceChar,
newlineChar,\n
multiplyChar,×
divideChar,÷
plusChar,+
equalsChar,=
subjectChar,:
thusChar,∴
, ArrayList<String>, :
private static ArrayList<String> readLinesFile(String ResourceFile) {
ArrayList<String> Lines = new ArrayList<String>();
try{
InputStream fstream = FileManager.class.getResourceAsStream(ResourceFile);
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
String strLine;
while ((strLine = br.readLine()) != null) {
Lines.add(strLine); }
in.close(); }
catch (Exception e) {
System.out.println("Error: " + e.getMessage()); }
return Lines; }
.
ArrayList , "," ( , ) .
private static Map<String, String> generateBaseUnits_Characters_Prefixes(ArrayList<String> FileContent) {
Map<String, String> BaseUnitsCache = new HashMap<String, String>();
ArrayList<String> currentLine;
for (int i=0; i<FileContent.size(); i++) {
currentLine = MiscellaneousFunctions.splitString(FileContent.get(i), ",");
BaseUnitsCache.put(currentLine.get(0), currentLine.get(1)); }
return BaseUnitsCache; }
, .
, , .
public static String variableIndentKey = "variableIndent";
public static String equalsIndentKey = "equalsIndent";
public static String spaceCharKey = "spaceChar";
public static String newlineCharKey = "newlineChar";
public static String multiplyCharKey = "multiplyChar";
public static String divideCharKey = "divideChar";
public static String plusCharKey = "plusChar";
public static String equalsCharKey = "equalsChar";
public static String subjectCharKey = "subjectChar";
public static String thusCharKey = "thusChar";
:
" " .
keySet , "null".
( variableIndent. variableIndent , equalsIndent ..)
!?
?!
.
!