Search in sources :

Example 21 with AbstractMap

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());
}
Also used : AbstractMap(java.util.AbstractMap) IdentityHashMap(java.util.IdentityHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) WeakHashMap(java.util.WeakHashMap) IdentityHashMap(java.util.IdentityHashMap) TreeMap(java.util.TreeMap) IdentityHashMap(java.util.IdentityHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) AbstractMap(java.util.AbstractMap) TreeMap(java.util.TreeMap) Map(java.util.Map) WeakHashMap(java.util.WeakHashMap) LinkedHashMap(java.util.LinkedHashMap) WeakHashMap(java.util.WeakHashMap)

Example 22 with AbstractMap

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());
}
Also used : AbstractMap(java.util.AbstractMap) IdentityHashMap(java.util.IdentityHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) WeakHashMap(java.util.WeakHashMap) IdentityHashMap(java.util.IdentityHashMap) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) AbstractMap(java.util.AbstractMap) TreeMap(java.util.TreeMap) Map(java.util.Map) WeakHashMap(java.util.WeakHashMap)

Example 23 with AbstractMap

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);
}
Also used : AbstractMap(java.util.AbstractMap) Decorator(javax.enterprise.inject.spi.Decorator) CurrentInjectionPoint(org.jboss.weld.injection.CurrentInjectionPoint) InjectionPoint(javax.enterprise.inject.spi.InjectionPoint) EmptyInjectionPoint(org.jboss.weld.injection.EmptyInjectionPoint)

Aggregations

AbstractMap (java.util.AbstractMap)23 LinkedHashMap (java.util.LinkedHashMap)14 HashMap (java.util.HashMap)13 IdentityHashMap (java.util.IdentityHashMap)13 TreeMap (java.util.TreeMap)12 Map (java.util.Map)8 WeakHashMap (java.util.WeakHashMap)8 Collection (java.util.Collection)5 Set (java.util.Set)5 Comparator (java.util.Comparator)3 Decorator (javax.enterprise.inject.spi.Decorator)1 InjectionPoint (javax.enterprise.inject.spi.InjectionPoint)1 Analyzer (org.apache.lucene.analysis.Analyzer)1 IndexSettings (org.elasticsearch.index.IndexSettings)1 IndexAnalyzers (org.elasticsearch.index.analysis.IndexAnalyzers)1 NamedAnalyzer (org.elasticsearch.index.analysis.NamedAnalyzer)1 MapperService (org.elasticsearch.index.mapper.MapperService)1 SimilarityService (org.elasticsearch.index.similarity.SimilarityService)1 CurrentInjectionPoint (org.jboss.weld.injection.CurrentInjectionPoint)1 EmptyInjectionPoint (org.jboss.weld.injection.EmptyInjectionPoint)1