if (dictionary == null) {
return;
}
// do this check only once in the beginning instead of using NSKeyValueCoding.Utility below
NSKeyValueCoding keyValueCodingObject = (object instanceof NSKeyValueCoding) ? (NSKeyValueCoding)object : null;
NSArray<String> keys = dictionary.allKeys();
int count = keys.count();
for (int i = 0; i < count; i++) {
String key = keys.objectAtIndex(i);
Object value = dictionary.objectForKey(key);
if (value == NSKeyValueCoding.NullValue) {
value = null;
}
if (keyValueCodingObject != null) {
if (ObjectUtils.notEqual(value, keyValueCodingObject.valueForKey(key))) {
keyValueCodingObject.takeValueForKey(value, key);
}
}
else {
if (ObjectUtils.notEqual(value, NSKeyValueCoding.DefaultImplementation.valueForKey(object, key))) {
NSKeyValueCoding.DefaultImplementation.takeValueForKey(object, value, key);