Package java.util

Examples of java.util.AbstractMap$BasicMapEntry


     * accessed easily from inside JSP EL (or other expression languages in
     * other view technologies).
     */
    protected Map createRequestContextWrapper(final ServletRequest request) {
        final WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(servletContext);
        Map wrapper = new AbstractMap() {

            public WebApplicationContext getContext() {
                return context;
            }

View Full Code Here


   }
  
   @Override
   public Object getWrappedData()
   {
      return new AbstractMap()
      {
         @Override
         public Set entrySet()
         {
            return new AbstractSet()
View Full Code Here

  }

  @SuppressWarnings("rawtypes")
  public void marshal(Object value, HierarchicalStreamWriter writer,
      MarshallingContext context) {
    AbstractMap map = (AbstractMap) value;
    for (Object obj : map.entrySet()) {
      Entry entry = (Entry) obj;
      writer.startNode(entry.getKey().toString());
      if (entry.getValue() instanceof String) {
        writer.setValue(entry.getValue().toString());
      } else if (entry.getValue() instanceof Map) {
View Full Code Here

    /**
     * @tests java.util.AbstractMap#clear()
     */
    public void test_clear() {
        // normal clear()
        AbstractMap map = new HashMap();
        map.put(1, 1);
        map.clear();
        assertTrue(map.isEmpty());

        // Special entrySet return a Set with no clear method.
        AbstractMap myMap = new MocAbstractMap();
        try {
            myMap.clear();
            fail("Should throw UnsupportedOprationException");
        } catch (UnsupportedOperationException e) {
            // expected
        }
    }
View Full Code Here

    /**
     * @tests java.util.AbstractMap#containsKey(Object)
     */
    public void test_containsKey() {
        AbstractMap map = new AMT();

        assertFalse(map.containsKey("k"));
        assertFalse(map.containsKey(null));

        map.put("k", "v");
        map.put("key", null);
        map.put(null, "value");
        map.put(null, null);

        assertTrue(map.containsKey("k"));
        assertTrue(map.containsKey("key"));
        assertTrue(map.containsKey(null));
    }
View Full Code Here

    /**
     * @tests java.util.AbstractMap#containsValue(Object)
     */
    public void test_containValue() {
        AbstractMap map = new AMT();

        assertFalse(map.containsValue("v"));
        assertFalse(map.containsValue(null));

        map.put("k", "v");
        map.put("key", null);
        map.put(null, "value");

        assertTrue(map.containsValue("v"));
        assertTrue(map.containsValue("value"));
        assertTrue(map.containsValue(null));
    }
View Full Code Here

    /**
     * @tests java.util.AbstractMap#get(Object)
     */
    public void test_get() {
        AbstractMap map = new AMT();
        assertNull(map.get("key"));
        assertNull(map.get(null));

        map.put("k", "v");
        map.put("key", null);
        map.put(null, "value");

        assertEquals("v", map.get("k"));
        assertNull(map.get("key"));
        assertEquals("value", map.get(null));
    }
View Full Code Here

    /**
     * @tests java.util.AbstractMap#values()
     */
    public void test_values() {
        AbstractMap map1 = new HashMap(0);
        assertSame("HashMap(0)", map1.values(), map1.values());

        AbstractMap map2 = new HashMap(10);
        assertSame("HashMap(10)", map2.values(), map2.values());

        Map map3 = Collections.EMPTY_MAP;
        assertSame("EMPTY_MAP", map3.values(), map3.values());

        AbstractMap map4 = new IdentityHashMap(1);
        assertSame("IdentityHashMap", map4.values(), map4.values());

        AbstractMap map5 = new LinkedHashMap(122);
        assertSame("IdentityHashMap", map5.values(), map5.values());

        AbstractMap map6 = new TreeMap();
        assertSame("TreeMap", map6.values(), map6.values());

        AbstractMap map7 = new WeakHashMap();
        assertSame("WeakHashMap", map7.values(), map7.values());
    }
View Full Code Here

    /**
     * @tests 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());
    }
View Full Code Here

     */
    public void test_removeLjava_lang_Object() {
        Object key = new Object();
        Object value = new Object();

        AbstractMap map1 = new HashMap(0);
        map1.put("key", value);
        assertSame("HashMap(0)", map1.remove("key"), value);

        AbstractMap map4 = new IdentityHashMap(1);
        map4.put(key, value);
        assertSame("IdentityHashMap", map4.remove(key), value);

        AbstractMap map5 = new LinkedHashMap(122);
        map5.put(key, value);
        assertSame("LinkedHashMap", map5.remove(key), value);

        AbstractMap map6 = new TreeMap(new Comparator() {
            // Bogus comparator
            public int compare(Object object1, Object object2) {
                return 0;
            }
        });
        map6.put(key, value);
        assertSame("TreeMap", map6.remove(key), value);

        AbstractMap map7 = new WeakHashMap();
        map7.put(key, value);
        assertSame("WeakHashMap", map7.remove(key), value);

        AbstractMap aSpecialMap = new MyMap();
        aSpecialMap.put(specialKey, specialValue);
        Object valueOut = aSpecialMap.remove(specialKey);
        assertSame("MyMap", valueOut, specialValue);
    }
View Full Code Here

TOP

Related Classes of java.util.AbstractMap$BasicMapEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.