use of java.util.AbstractMap in project robovm by robovm.
the class AbstractMapTest method test_keySet.
/**
* java.util.AbstractMap#keySet()
*/
public void test_keySet() {
AbstractMap map1 = new HashMap(0);
assertSame("HashMap(0)", map1.keySet(), map1.keySet());
AbstractMap map2 = new HashMap(10);
assertSame("HashMap(10)", map2.keySet(), map2.keySet());
Map map3 = Collections.EMPTY_MAP;
assertSame("EMPTY_MAP", map3.keySet(), map3.keySet());
AbstractMap map4 = new IdentityHashMap(1);
assertSame("IdentityHashMap", map4.keySet(), map4.keySet());
AbstractMap map5 = new LinkedHashMap(122);
assertSame("LinkedHashMap", map5.keySet(), map5.keySet());
AbstractMap map6 = new TreeMap();
assertSame("TreeMap", map6.keySet(), map6.keySet());
AbstractMap map7 = new WeakHashMap();
assertSame("WeakHashMap", map7.keySet(), map7.keySet());
}
use of java.util.AbstractMap in project robovm by robovm.
the class AbstractMapTest method test_clone.
/**
* java.util.AbstractMap#clone()
*/
public void test_clone() {
class MyMap extends AbstractMap implements Cloneable {
private Map map = new HashMap();
public Set entrySet() {
return map.entrySet();
}
public Object put(Object key, Object value) {
return map.put(key, value);
}
public Map getMap() {
return map;
}
public Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
// android-changed
throw new AssertionError(e);
}
}
}
;
MyMap map = new MyMap();
map.put("one", "1");
Map.Entry entry = (Map.Entry) map.entrySet().iterator().next();
assertTrue("entry not added", entry.getKey() == "one" && entry.getValue() == "1");
MyMap mapClone = (MyMap) map.clone();
assertTrue("clone not shallow", map.getMap() == mapClone.getMap());
}
use of java.util.AbstractMap in project aries by apache.
the class ConfigurationBean method create0.
protected <T> T create0(CreationalContext<T> creationalContext) {
Map<String, Object> map = new AbstractMap<String, Object>() {
@Override
public Set<java.util.Map.Entry<String, Object>> entrySet() {
return _configurationDependency.getConfiguration().entrySet();
}
};
T instance = cast(Conversions.c().convert(map).to(_configurationDependency.getBeanClass()));
InjectionPoint ip = getInjectionPoint(_currentInjectionPoint);
if (ip == null) {
return instance;
}
List<Decorator<?>> decorators = getDecorators(ip);
if (decorators.isEmpty()) {
return instance;
}
return Decorators.getOuterDelegate(cast(this), instance, creationalContext, cast(getBeanClass()), ip, _beanManagerImpl, decorators);
}
Aggregations