我想比较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