I got a problem in String type that :
String from list-String is not the same as original String
Here are my sample codes
Map<String, List<String>> parameters_test=new HashMap<String, List<String>>();
parameters_test.put("0",new LinkedList<String>());parameters_test.get("0").add("WM188126M");
parameters_test.put("1",new LinkedList<String>());parameters_test.get("1").add("BXJ006");
parameters_test.put("2",new LinkedList<String>());parameters_test.get("2").add("1829690014");
parameters_test.put("3",new LinkedList<String>());parameters_test.get("3").add("16");
and then put the map to another method
if (getParamsMap() != null) {
for (String item : getParamsMap().keySet()) {
List<String> valueList = getParamsMap().get(item);
if (valueList == null || valueList.isEmpty()) {
continue;
}
if (item.equals("0")) {
woCode = valueList.get(0);
} else if (item.equals("1")) {
product = valueList.get(0);
} else if (item.equals("2")) {
purchaseOrder = valueList.get(0);
} else if (item.equals("3")) {
labelNumbers = valueList.get(0);
}
}
}
if(woCode.equals("WM188126M")){
System.out.println("01 true");
}else{
System.out.println("01 fail");
}
if(product.equals("BXJ006")){
System.out.println("02 true");
}else{
System.out.println("02 fail");
}
if(purchaseOrder.equals("1829690014")){
System.out.println("03 true");
}else{
System.out.println("03 fail");
}
if(labelNumbers.equals("16")){
System.out.println("04 true");
}else{
System.out.println("04 fail");
}
Why do I always get an result like this : 01 true 02 true 03 fail 04 fail
It's all okay for a long while. errors appeared recently.
but I didn't change anything.
The code is used in Java 1.6 64bit
- Eclipse
Text file Encoding : UTF-8
I have been tried for a long while. Best regards for anyone who gives a hand.