Package java.util

Examples of java.util.Map$Entry


        map.put("two", "Three");
        assertEquals("Three", (String) map.get("Two"));
    }
   
    public void testNullHandling() {
        Map map = new CaseInsensitiveMap();
        map.put("One", "One");
        map.put("Two", "Two");
        map.put(null, "Three");
        assertEquals("Three", (String) map.get(null));
        map.put(null, "Four");
        assertEquals("Four", (String) map.get(null));
        Set keys = map.keySet();
        assertTrue(keys.contains("one"));
        assertTrue(keys.contains("two"));
        assertTrue(keys.contains(null));
        assertTrue(keys.size() == 3);
    }
View Full Code Here


        assertTrue(keys.contains(null));
        assertTrue(keys.size() == 3);
    }
       
    public void testPutAll() {
        Map map = new HashMap();
        map.put("One", "One");
        map.put("Two", "Two");
        map.put("one", "Three");
        map.put(null, "Four");
        map.put(new Integer(20), "Five");
        Map caseInsensitiveMap = new CaseInsensitiveMap(map);
        assertTrue(caseInsensitiveMap.size() == 4); // ones collapsed
        Set keys = caseInsensitiveMap.keySet();
        assertTrue(keys.contains("one"));
        assertTrue(keys.contains("two"));
        assertTrue(keys.contains(null));
        assertTrue(keys.contains(Integer.toString(20)));
        assertTrue(keys.size() == 4);
        assertTrue(!caseInsensitiveMap.containsValue("One")
            || !caseInsensitiveMap.containsValue("Three")); // ones collaped
        assertEquals(caseInsensitiveMap.get(null), "Four");
    }
View Full Code Here

   * @param map The map to which the key-value pairs are added
   */
  public Map toMapString str, String elementSeparator,
                    String keyValueSeparator, Map map )
  {
    Map result ;
    String elemSep ;
    String kvSep ;
    String[] assignments ;
    String[] nameValue ;
   
    if ( str == null )
      return map ;
     
    result = ( map == null ? new Hashtable() : map ) ;
    elemSep = ( elementSeparator == null ) ? "," : elementSeparator ;
    kvSep = ( keyValueSeparator == null ) ? "=" : keyValueSeparator ;
   
    assignments = this.parts( str, elemSep ) ;
    for ( int i = 0 ; i < assignments.length ; i++ )
    {
      nameValue = this.splitNameValue( assignments[i], kvSep ) ;
      nameValue[0] = nameValue[0].trim() ;
      nameValue[1] = nameValue[1].trim() ;
      if ( nameValue[0].length() > 0 )
        result.put( nameValue[0], nameValue[1] ) ;
    }
   
    return result ;
  } // asMap()
View Full Code Here

        if (javaObject == null) {
            return null;
        }

        String actionName = null;
        Map queryParams = params instanceof Scriptable ?
                core.scriptableToProperties((Scriptable) params) : null;

        if (action != null) {
            if (action instanceof Wrapper) {
                actionName = ((Wrapper) action).unwrap().toString();
View Full Code Here

  getBrowserHeaders(
    String          referer )
  {
    String  headers_to_use = getBrowserHeadersToUse( null );
   
    Map  result = new HashMap();
   
    try{
   
      String header_string = new String( Base64.decode( headers_to_use ), "UTF-8" );
   
      String[]  headers = header_string.split( "\n" );
     
      for (int i=0;i<headers.length;i++ ){
     
        String  header = headers[i];
       
        int  pos = header.indexOf( ':' );
       
        if ( pos != -1 ){
         
          String  lhs = header.substring(0,pos).trim();
          String  rhs  = header.substring(pos+1).trim();
         
          if ( !( lhs.equalsIgnoreCase( "Host") ||
              lhs.equalsIgnoreCase( "Referer" ))){
           
            result.put( lhs, rhs );
          }
        }
      }
     
      if ( referer != null && referer.length() > 0){
       
        result.put( "Referer", referer );
      }
    }catch( Throwable e ){   
    }
   
    return( result );
View Full Code Here

            }
          }
          continue;
        }

        Map map = (Map) lgmap.get(key);
        Iterator it = map.keySet().iterator();

        while (it.hasNext()) {
          CalendarActivityObject cao = (CalendarActivityObject) map.get(it.next());
          ArrayList activitiesAttendeesList = cao.getActivityAttendee();
          if ("PRIVATE".equals(cao.getActivityVisibility()) && cao.getActivityOwnerId() != individualID
              && !activitiesAttendeesList.contains(individualID + "")) {
            cao.setActivity("Private");
            cao.setActivityDetail("Private");
View Full Code Here

    {
      return null;
    }
    else
    {
      Map map = (Map) session.getAttribute(InfrastructureKeys.REDIRECT_PARAMETERS);
      if (map != null)
      {
        return map.get(parameterName);
      }
      return null;
    }
  }
View Full Code Here

      }
    });
    Source source = new Source();
    source.setStringValue("A");

    Map result = beanMapper.map(source, HashMap.class);
    assertEquals("A", result.get("key"));
  }
View Full Code Here

    list.add(b1);
    list.add(b2);
    list.add(b3);

    Map map = mapper.map(list, HashMap.class);
   
    assertNotNull(map);
    assertEquals(3, map.size());
    assertTrue(map.keySet().contains(b1));
    assertTrue(map.keySet().contains(b2));
    assertTrue(map.keySet().contains(b3));
    assertEquals(b1.getA(), ((BeanB) map.get(b1)).getA().toString());
    assertEquals(b2.getA(), ((BeanB) map.get(b2)).getA().toString());
    assertEquals(b3.getA(), ((BeanB) map.get(b3)).getA().toString());
  }
View Full Code Here

    public Converter() {
      super(List.class, Map.class);
    }

    public Map convertTo(List source, Map destination) {
      Map result = new HashMap();
      for (Object item : source) {
        BeanB mappedItem = mapper.map(item, BeanB.class);
        result.put(item, mappedItem);
      }
      return result;
    }
View Full Code Here

TOP

Related Classes of java.util.Map$Entry

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.