Package java.util

Examples of java.util.AbstractMap$AbstractEntry


        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


   }
  
   @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

    public Object unmarshall(SerializerState state, Class clazz, Object o) throws UnmarshallException {
        JSONObject jso = (JSONObject) o;
        String java_class = jso.getString("javaClass");
        if (java_class == null)
            throw new UnmarshallException("no type hint");
        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 = jso.getJSONObject("map");
        if (jsonmap == null)
            throw new UnmarshallException("map missing");
        Iterator i = jsonmap.keys();
        String key = null;

        while (i.hasNext()) {
            key = (String) i.next();
            abmap.put(JSON.getObject(key.substring(0, key.indexOf("$mapHashID"))), JSON.getObject((String) jsonmap.get(key)));
        }
        return abmap;
    }
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

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

   
    @Override
    public synchronized void stop() throws LifecycleException
    {
        if ( !this.started ) return;
        AbstractMap map = (AbstractMap)((ReplApplContext)this.context).getAttributeMap();
        if ( map!=null && map instanceof ReplicatedMap) {
            ((ReplicatedMap)map).breakdown();
        }
        try {
            super.lifecycle.removeLifecycleListener(this);
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.