我想比較db4o和JSON中的對象。如果在JSON中不存在,我應該刪除db4o中的對象。比較兩個字段的錯誤
我有一個問題與if:
if(tratdb4o.getMedication()==tratJson.getMedication()
我登錄了兩個字符串變量又都是相同的,但不進入如果改變igual的價值。
有人知道爲什麼嗎?的
for (int i=0;it2.hasNext();i++) {
objetoDb4o=it2.next();
tratdb4o=(Tratam)objetoDb4o;
for (int j=0;it.hasNext();j++) {
objetoJson = it.next();
tratJson = (Tratam)objetoJson;
Log.d(TAG,"Comparing "+tratdb4o.getMedication()+" of db4o "+ tratJson.getMedication() +" of JSON");
if(tratdb4o.getMedication()==tratJson.getMedication()
igual true;
}
if (igual==false){
db4oHelper.db().delete(tratdb4o);
db4oHelper.listResult();
}
igual=false;
it=listaendb4o.iterator();
}
}
你能發佈錯誤嗎? – Ami