Source:
<code>private void completedAsyncRealmObject(QueryUpdateTask.Result result) { Set<WeakReference<RealmObjectProxy>> updatedRowKey = result.updatedRow.keySet(); if (updatedRowKey.size() > 0) { WeakReference<RealmObjectProxy> realmObjectWeakReference = updatedRowKey.iterator().next(); RealmObjectProxy proxy = realmObjectWeakReference.get(); if (proxy != null) { SharedGroup.VersionID callerVersionID = realm.sharedGroupManager.getVersion(); int compare = callerVersionID.compareTo(result.versionID); if (compare == 0) { long rowPointer = result.updatedRow.get(realmObjectWeakReference); if (rowPointer != 0 && emptyAsyncRealmObject.containsKey(realmObjectWeakReference)) { emptyAsyncRealmObject.remove(realmObjectWeakReference); <START> realmObjects.put(realmObjectWeakReference, Boolean.TRUE); <END> } proxy.realmGet$proxyState().onCompleted$realm(rowPointer); proxy.realmGet$proxyState().notifyChangeListeners$realm(); } else if (compare > 0) { if (RealmObject.isValid(proxy)) { RealmLog.d("[COMPLETED_ASYNC_REALM_OBJECT "+ proxy + "] , realm:" + HandlerController.this + " RealmObject is already loaded, just notify it."); proxy.realmGet$proxyState().notifyChangeListeners$realm(); } else { RealmLog.d("[COMPLETED_ASYNC_REALM_OBJECT " + proxy + "] , realm:" + HandlerController.this + " RealmObject is not loaded yet. Rerun the query."); Object value = realmObjects.get(realmObjectWeakReference); RealmQuery<? extends RealmModel> realmQuery; if (value == null || value == Boolean.TRUE) { realmQuery = emptyAsyncRealmObject.get(realmObjectWeakReference); } else { realmQuery = (RealmQuery<? extends RealmModel>) value; } QueryUpdateTask queryUpdateTask = QueryUpdateTask.newBuilder() .realmConfiguration(realm.getConfiguration()) .addObject(realmObjectWeakReference, realmQuery.handoverQueryPointer(), realmQuery.getArgument()) .sendToHandler(realm.handler, COMPLETED_ASYNC_REALM_OBJECT) .build(); Realm.asyncTaskExecutor.submit(queryUpdateTask); } } else { throw new IllegalStateException("Caller thread behind the Worker thread"); } } } }</code><technical_language>Boolean.TRUE is I move a properly named class constant</technical_language>

Target:
private void completedAsyncRealmObject(QueryUpdateTask.Result result) { Set<WeakReference<RealmObjectProxy>> updatedRowKey = result.updatedRow.keySet(); if (updatedRowKey.size() > 0) { WeakReference<RealmObjectProxy> realmObjectWeakReference = updatedRowKey.iterator().next(); RealmObjectProxy proxy = realmObjectWeakReference.get(); if (proxy != null) { SharedGroup.VersionID callerVersionID = realm.sharedGroupManager.getVersion(); int compare = callerVersionID.compareTo(result.versionID); if (compare == 0) { long rowPointer = result.updatedRow.get(realmObjectWeakReference); if (rowPointer != 0 && emptyAsyncRealmObject.containsKey(realmObjectWeakReference)) { emptyAsyncRealmObject.remove(realmObjectWeakReference); realmObjects.put(realmObjectWeakReference, NO_REALM_QUERY); } proxy.realmGet$proxyState().onCompleted$realm(rowPointer); proxy.realmGet$proxyState().notifyChangeListeners$realm(); } else if (compare > 0) { if (RealmObject.isValid(proxy)) { RealmLog.d("[COMPLETED_ASYNC_REALM_OBJECT "+ proxy + "] , realm:" + HandlerController.this + " RealmObject is already loaded, just notify it."); proxy.realmGet$proxyState().notifyChangeListeners$realm(); } else { RealmLog.d("[COMPLETED_ASYNC_REALM_OBJECT " + proxy + "] , realm:" + HandlerController.this + " RealmObject is not loaded yet. Rerun the query."); Object value = realmObjects.get(realmObjectWeakReference); RealmQuery<? extends RealmModel> realmQuery; if (value == null || value == NO_REALM_QUERY) { realmQuery = emptyAsyncRealmObject.get(realmObjectWeakReference); } else { realmQuery = (RealmQuery<? extends RealmModel>) value; } QueryUpdateTask queryUpdateTask = QueryUpdateTask.newBuilder() .realmConfiguration(realm.getConfiguration()) .addObject(realmObjectWeakReference, realmQuery.handoverQueryPointer(), realmQuery.getArgument()) .sendToHandler(realm.handler, COMPLETED_ASYNC_REALM_OBJECT) .build(); Realm.asyncTaskExecutor.submit(queryUpdateTask); } } else { throw new IllegalStateException("Caller thread behind the Worker thread"); } } } }