for (int i=0; i<len; i++) {
Object key = keys[i];
- key = getComparableKey(result, key);
Object value = values[i];
result.put(key, value);
}
for (int i=0; i<len; i++) {
Object key = keys.get(i);
- key = getComparableKey(result, key);
Object value = values.get(i);
result.put(key, value);
}
for (int i=0; i<len; i++) {
Object key = keys[i];
- key = getComparableKey(result, key);
Object value = values[i];
result.put(key, value);
}
for (int i=0; i<len; i++) {
Object key = keys.get(i);
- key = getComparableKey(result, key);
Object value = values.get(i);
result.put(key, value);
}
}
return values;
}
-
- @SuppressWarnings("unchecked")
- protected Object getComparableKey(Object map, Object key) {
- // if (keyIsComparable) return key;
-
- Map<Object, Object> m = ((Map<Object, Object>)map);
- Binding kb = getKeyBinding();
- for (Object k : m.keySet())
- {
- if (kb.equals(k, key))
- return k;
- }
- return key;
- }
@SuppressWarnings("unchecked")
@Override
public void put(Object map, Object key, Object value) {
Map<Object, Object> m = ((Map<Object, Object>)map);
- Object ck = getComparableKey(m, key);
- m.remove(ck);
m.put(key, value);
}
public <K, V> void putAll(Object map, Map<K, V> src) throws BindingException {
Map<K, V> m = ((Map<K, V> )map);
for (Entry<K, V> e : (Set<Entry<K, V> >) src.entrySet()) {
- Object ck = getComparableKey(map, e.getKey());
- m.remove(ck);
m.put(e.getKey(), e.getValue());
}
}