db4o と JSON のオブジェクトを比較したいのですが、JSON に存在しない場合は、db4o のオブジェクトを削除する必要があります。
次の場合に問題があります。
if(tratdb4o.getMedication()==tratJson.getMedication()
2 つの文字列変数をログに記録し、両方とも同じですが、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();
}
}