Package java.util

Examples of java.util.AbstractMap$AbstractEntry


    Collection values = map.values();
    assertEquals("values() does not work",
        "value", values.iterator().next());
    assertEquals("keySet() does not work",
        "key", keys.iterator().next());
    AbstractMap map2 = (AbstractMap) map.clone();
    map2.put("key", "value2");
    Collection values2 = map2.values();
    assertTrue("values() is identical", values2 != values);
    // values() and keySet() on the cloned() map should be different
    assertEquals("values() was not cloned",
        "value2", values2.iterator().next());
    map2.clear();
    map2.put("key2", "value3");
    Set key2 = map2.keySet();
    assertTrue("keySet() is identical", key2 != keys);
    assertEquals("keySet() was not cloned",
        "key2", key2.iterator().next());
       
        // regresion test for HARMONY-4603
View Full Code Here


        Set keys = map.keySet();
        Collection values = map.values();
        assertEquals("values() does not work", "value", values.iterator()
                .next());
        assertEquals("keySet() does not work", "key", keys.iterator().next());
        AbstractMap map2 = (AbstractMap) map.clone();
        map2.put("key", "value2");
        Collection values2 = map2.values();
        assertTrue("values() is identical", values2 != values);
        // values() and keySet() on the cloned() map should be different
        assertEquals("values() was not cloned", "value2", values2.iterator()
                .next());
        map2.clear();
        map2.put("key2", "value3");
        Set key2 = map2.keySet();
        assertTrue("keySet() is identical", key2 != keys);
        assertEquals("keySet() was not cloned", "key2", key2.iterator().next());
    }
View Full Code Here

     * 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

            throw new UnmarshallException("Could not read javaClass", e);
        }
        if (java_class == null) {
            throw new UnmarshallException("no type hint");
        }
        AbstractMap abmap;
        if (java_class.equals("java.util.Map") || java_class.equals("java.util.AbstractMap") || java_class.equals("java.util.HashMap")) {
            abmap = new HashMap();
        } else if (java_class.equals("java.util.TreeMap")) {
            abmap = new TreeMap();
        } else if (java_class.equals("java.util.LinkedHashMap")) {
            abmap = new LinkedHashMap();
        } else {
            throw new UnmarshallException("'" + java_class + "' is not a Map");
        }
        JSONObject jsonmap;
        try {
            jsonmap = jso.getJSONObject("map");
        } catch (JSONException e) {
            throw new UnmarshallException("Could not read map: " + e.getMessage(), e);
        }
        if (jsonmap == null) {
            throw new UnmarshallException("map missing");
        }
        state.setSerialized(o, abmap);
        Iterator i = jsonmap.keys();
        String key = null;
        try {
            while (i.hasNext()) {
                key = (String) i.next();
                abmap.put(key, _ser.unmarshall(state, null, jsonmap.get(key)));
            }
        } catch (UnmarshallException e) {
            throw new UnmarshallException("key " + key + " " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new UnmarshallException("key " + key + " " + e.getMessage(), e);
View Full Code Here

     * Creates a wrapper around the web application context so that it can be
     * accessed easily from inside JSP EL (or other expression languages in
     * other view technologies).
     */
    protected Map createApplicationContextWrapper(final WebApplicationContext context) {
        Map wrapper = new AbstractMap() {

            public WebApplicationContext getContext() {
                return context;
            }

View Full Code Here

     * 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

    Collection values = map.values();
    assertEquals("values() does not work",
        "value", values.iterator().next());
    assertEquals("keySet() does not work",
        "key", keys.iterator().next());
    AbstractMap map2 = (AbstractMap) map.clone();
    map2.put("key", "value2");
    Collection values2 = map2.values();
    assertTrue("values() is identical", values2 != values);
    // values() and keySet() on the cloned() map should be different
    assertEquals("values() was not cloned",
        "value2", values2.iterator().next());
    map2.clear();
    map2.put("key2", "value3");
    Set key2 = map2.keySet();
    assertTrue("keySet() is identical", key2 != keys);
    assertEquals("keySet() was not cloned",
        "key2", key2.iterator().next());
       
        // regresion test for HARMONY-4603
View Full Code Here

    public Object unmarshall(SerializerState state, Class clazz, Object o)
  throws UnmarshallException
    {
  JSONObject jso = (JSONObject)o;
  String java_class = getJavaClass(jso);
  AbstractMap abmap = null;
  if(java_class.equals("java.util.Map") ||
     java_class.equals("java.util.AbstractMap") ||
     java_class.equals("java.util.HashMap")) {
      abmap = new HashMap();
  } else if(java_class.equals("java.util.TreeMap")) {
      abmap = new TreeMap();
  } else if(java_class.equals("java.util.LinkedHashMap")) {
      abmap = new LinkedHashMap();
  } else {
      throw new UnmarshallException("not a Map");
  }
  JSONObject jsonmap = getMap(jso);
  Iterator i = jsonmap.keys();
  String key = null;
  try {
      while(i.hasNext()) {
    key = (String)i.next();
    abmap.put(key, ser.unmarshall(state, null, jsonmap.get(key)));
      }
  } catch (JSONException e) {
      throw new UnmarshallException("key " + key + " " + e.getMessage());
  } catch (UnmarshallException e) {
      throw new UnmarshallException
View Full Code Here

        Set keys = map.keySet();
        Collection values = map.values();
        assertEquals("values() does not work", "value", values.iterator()
                .next());
        assertEquals("keySet() does not work", "key", keys.iterator().next());
        AbstractMap map2 = (AbstractMap) map.clone();
        map2.put("key", "value2");
        Collection values2 = map2.values();
        assertTrue("values() is identical", values2 != values);
        // values() and keySet() on the cloned() map should be different
        assertEquals("values() was not cloned", "value2", values2.iterator()
                .next());
        map2.clear();
        map2.put("key2", "value3");
        Set key2 = map2.keySet();
        assertTrue("keySet() is identical", key2 != keys);
        assertEquals("keySet() was not cloned", "key2", key2.iterator().next());
    }
View Full Code Here

     * Creates a wrapper around the web application context so that it can be
     * accessed easily from inside JSP EL (or other expression languages in
     * other view technologies).
     */
    protected Map createApplicationContextWrapper(final WebApplicationContext context) {
        Map wrapper = new AbstractMap() {

            public WebApplicationContext getContext() {
                return context;
            }

View Full Code Here

TOP

Related Classes of java.util.AbstractMap$AbstractEntry

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.