当前位置: 首页>>代码示例>>Java>>正文


Java Map.get方法代码示例

本文整理汇总了Java中java.util.Map.get方法的典型用法代码示例。如果您正苦于以下问题:Java Map.get方法的具体用法?Java Map.get怎么用?Java Map.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Map的用法示例。


在下文中一共展示了Map.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _checkStartingStampingTag

import java.util.Map; //导入方法依赖的package包/类
/**
 * Checks if the current tag is a stamping tag. If so, a counter is incremented so that it can
 * be tracked when we are outside all stamping tags again.
 *
 * @see #_checkEndingStampingTag()
 * @see #isStampingTag()
 * @param facesContextAttributes
 */
private void _checkStartingStampingTag(
  Map<Object, Object> facesContextAttributes)
{
  if (isStampingTag())
  {
    AtomicInteger count = (AtomicInteger)facesContextAttributes.get(_STAMPING_COUNT_KEY);
    if (count == null)
    {
      // Use an atomic integer here so that we can increment and decrement the value without
      // having to store a new integer value into the map each time. This avoids the overhead
      // of the map.put operation.
      facesContextAttributes.put(_STAMPING_COUNT_KEY, new AtomicInteger(1));
    }
    else
    {
      // Only used on one thread, so use the safe methods for performance (only using the
      // atomic integer for higher performance than boxing int to Integer)
      count.set(count.get() + 1);
    }
  }
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:30,代码来源:UIXComponentELTag.java

示例2: parseAddress

import java.util.Map; //导入方法依赖的package包/类
private InetAddress parseAddress(final Map<String, String> properties) throws InvalidConfigurationException {

        final String addressAsString = properties.get(TARGET_ADDRESS);

        if (addressAsString == null) {
            throw InvalidConfigurationException.missingProperty(TARGET_ADDRESS);
        }

        final InetAddress address;

        try {
            address = inetAddressFactory.createByName(addressAsString);
        } catch (final Exception ex) {
            throw new InvalidConfigurationException("Property " + TARGET_ADDRESS
                    + " is not a valid IP address or hostname: " + ex.getMessage());
        }

        return address;

    }
 
开发者ID:galop-proxy,项目名称:galop,代码行数:21,代码来源:TargetConfigurationFactoryImpl.java

示例3: addTestInfoForCodeElement

import java.util.Map; //导入方法依赖的package包/类
/**
 * Adds test info to an identified element.
 */
private void addTestInfoForCodeElement(RepoRelativePath rrp, Doclet testMethodDoclet, FullMemberReference ref,
		TMember testMember, Map<String, SpecInfo> typesByName) {
	SpecInfo specInfo = typesByName.get(ref.fullTypeName());
	if (specInfo != null) {
		for (Type testee : specInfo.specElementRef.getTypes()) {
			if (testee instanceof ContainerType<?> && ref.memberNameSet()) {
				TMember testeeMember = getRefMember((ContainerType<?>) testee, ref);
				if (testeeMember != null) {
					specInfo.addMemberTestInfo(
							testeeMember,
							createTestSpecInfo(testeeMember.getName(), testMethodDoclet, testMember, rrp));
				}
				return;
			}
		}
		// Type, TFunction of TVariable
		specInfo.addTypeTestInfo(createTestSpecInfo(specInfo.specElementRef.identifiableElement.getName(),
				testMethodDoclet, testMember, rrp));
	} else {
		issueAcceptor.addWarning("Testee " + ref.fullTypeName() + " not found", testMember);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:26,代码来源:N4JSDReader.java

示例4: parse

import java.util.Map; //导入方法依赖的package包/类
static ExoticPayoffPool parse(Map<String, List<ChartCharacter>> payoffGrid)
        throws ChartParserException {
    List<ChartCharacter> chartCharacters = payoffGrid.get("WagerType");
    String wagerType = Chart.convertToText(chartCharacters);
    WagerNameUnit wagerNameUnit = parseWagerType(wagerType);

    String winningNumbersPayoffText = Chart.convertToText(
            payoffGrid.get("WinningNumbersPayoff"));
    WinningNumbersPayoff winningNumbersPayoff =
            parseWinningNumbersAndPayoff(winningNumbersPayoffText);

    String poolText = Chart.convertToText(payoffGrid.get("Pool"));
    Double pool = parsePool(poolText);

    String carryoverText = Chart.convertToText(payoffGrid.get("Carryover"));
    Double carryover = parseCarryover(carryoverText);

    return new ExoticPayoffPool(wagerNameUnit, winningNumbersPayoff, pool, carryover);
}
 
开发者ID:robinhowlett,项目名称:chart-parser,代码行数:20,代码来源:WagerPayoffPools.java

示例5: setStringsWithGroup

import java.util.Map; //导入方法依赖的package包/类
/**
 * 指定组批量写入字符串
 * @param groupName 缓存组
 * @param keyValueMap
 * @return
 */
public static boolean setStringsWithGroup(String groupName, Map<String, Object> keyValueMap) {
    if (keyValueMap == null || keyValueMap.isEmpty()) { return false; }
    String[] keysValues = new String[keyValueMap.size() * 2];
    int index = 0;
    for (String key : keyValueMap.keySet()) {
        if (keyValueMap.get(key) == null) { continue; }
        keysValues[index++] = key;
        keysValues[index++] = keyValueMap.get(key).toString();
    }
    try {
        if (JedisProviderFactory.isCluster(groupName)) {
            return JedisProviderFactory.getMultiKeyJedisClusterCommands(groupName)
                    .mset(keysValues).equals(RESP_OK);
        } else {
            return JedisProviderFactory.getMultiKeyCommands(groupName).mset(keysValues)
                    .equals(RESP_OK);
        }
    } finally {
        JedisProviderFactory.getJedisProvider(groupName).release();
    }
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:28,代码来源:RedisBatchCommand.java

示例6: getInfoByIdService

import java.util.Map; //导入方法依赖的package包/类
/**
 * ���id��ȡ��ݼ�¼
 * @param requestParamMap �ύ����
 * @param tableName ����� 
 * @return
 * @throws Exception
 */	
public Map getInfoByIdService(Map requestParamMap,String tableName){
	String tempKeyId=calcuIdKey();
	String id=(String) requestParamMap.get(tempKeyId);
	//add 20170831 ninghao
	Map filterViewRet=filterView4Select(tableName,requestParamMap,id,tempKeyId,TYPE_SELECT_ID);
	if(filterViewRet!=null ){
		return filterViewRet;
	}
	
	Map retMap=getInnerDao().queryObjJoinByBizId(tableName, id, tempKeyId);
	if(retMap==null){
		return null;
	}
	CheckModelTypeUtil.addMetaCols(retMap);
	CheckModelTypeUtil.changeNoStrCols(retMap);
	return retMap;
}
 
开发者ID:jeffreyning,项目名称:nh-micro,代码行数:25,代码来源:MicroServiceTemplateSupport.java

示例7: sortStickers

import java.util.Map; //导入方法依赖的package包/类
private static PriorityQueue sortStickers(){
    Map stickers = EventsManager.getStickers();
    PriorityQueue pQ = new PriorityQueue(stickers.size());
	for (Iterator i = stickers.keySet().iterator(); i.hasNext();) {
    	String id = (String)i.next();
    	Element el = (Element)stickers.get(id);
    	int j=2;
    	j=Integer.parseInt(el.getAttributeValue("priority"));
    	pQ.insertar(new Pair(el,j));
	}
	return pQ;
}
 
开发者ID:ser316asu,项目名称:SER316-Ingolstadt,代码行数:13,代码来源:AgendaGenerator.java

示例8: generateTimestamp

import java.util.Map; //导入方法依赖的package包/类
private static JSONObject generateTimestamp(Map<String, Object> mainMetrics, int sampleCount) {
    JSONObject result = new JSONObject();

    result.put("sum", mainMetrics.get("sumTime"));
    result.put("n", sampleCount);

    long average = (long) mainMetrics.get("sumTime") / sampleCount;
    Map<String, Long> perc = getQuantiles((Long[]) mainMetrics.get("rtimes"), average);
    result.put("avg", average);
    result.put("std", perc.get("std"));
    result.put("min", perc.get("min"));
    result.put("max", perc.get("max"));

    return result;
}
 
开发者ID:Blazemeter,项目名称:jmeter-bzm-plugins,代码行数:16,代码来源:JSONConverter.java

示例9: add

import java.util.Map; //导入方法依赖的package包/类
public void add(Map<String, Object> context) {
    String service = (String) context.get("service");
    if (service == null || service.length() == 0) {
        List<String> serviceList = Tool.sortSimpleName(new ArrayList<String>(providerService.findServices()));
        context.put("serviceList", serviceList);
    }
}
 
开发者ID:l1325169021,项目名称:github-test,代码行数:8,代码来源:Owners.java

示例10: getFilterConfigMap

import java.util.Map; //导入方法依赖的package包/类
public static Map<String, String> getFilterConfigMap(Configuration conf,
    String prefix) {
  Map<String, String> filterConfig = new HashMap<String, String>();

  //setting the cookie path to root '/' so it is used for all resources.
  filterConfig.put(AuthenticationFilter.COOKIE_PATH, "/");

  for (Map.Entry<String, String> entry : conf) {
    String name = entry.getKey();
    if (name.startsWith(prefix)) {
      String value = conf.get(name);
      name = name.substring(prefix.length());
      filterConfig.put(name, value);
    }
  }

  //Resolve _HOST into bind address
  String bindAddress = conf.get(HttpServer2.BIND_ADDRESS);
  String principal = filterConfig.get(KerberosAuthenticationHandler.PRINCIPAL);
  if (principal != null) {
    try {
      principal = SecurityUtil.getServerPrincipal(principal, bindAddress);
    }
    catch (IOException ex) {
      throw new RuntimeException("Could not resolve Kerberos principal name: " + ex.toString(), ex);
    }
    filterConfig.put(KerberosAuthenticationHandler.PRINCIPAL, principal);
  }
  return filterConfig;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:AuthenticationFilterInitializer.java

示例11: setPreFilter

import java.util.Map; //导入方法依赖的package包/类
public void setPreFilter ( final Map<String, String> properties ) throws Exception
{
    final ConfigurationDataHelper cfg = new ConfigurationDataHelper ( properties );

    if ( properties != null )
    {
        setPreFilter ( properties.get ( "for.id" ), properties.get ( "for.type" ), properties.get ( "for.action" ) );
    }

    final String script = properties.get ( "filter.script" );
    if ( script != null && !script.isEmpty () )
    {
        this.scriptFilter = new ScriptExecutor ( this.engineManager, cfg.getString ( "filter.script.engine", "JavaScript" ), script, AbstractBaseRule.class.getClassLoader () );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:16,代码来源:AbstractBaseRule.java

示例12: getEmailVerifiedUpdatedFlag

import java.util.Map; //导入方法依赖的package包/类
@Override
public String getEmailVerifiedUpdatedFlag(String userId) {
  UserResource resource =
      keycloak.realm(KeyCloakConnectionProvider.SSO_REALM).users().get(userId);
  UserRepresentation user = resource.toRepresentation();
  Map<String, List<String>> map = user.getAttributes();
  List<String> list = map.get(JsonKey.EMAIL_VERIFIED_UPDATED);
  if (!list.isEmpty()) {
    return list.get(0);
  } else {
    return "";
  }
}
 
开发者ID:project-sunbird,项目名称:sunbird-utils,代码行数:14,代码来源:KeyCloakServiceImpl.java

示例13: getEventTimingsByPlugin

import java.util.Map; //导入方法依赖的package包/类
public static Map<String, MonitorRecord> getEventTimingsByPlugin(Plugin plg) {
	Map<String, MonitorRecord> record = new HashMap<>();
	if (plg == null) {
		return record;
	}
	for (RegisteredListener listener : HandlerList.getRegisteredListeners(plg)) {
		try {
			FieldAccessor<EventExecutor> field = Reflection.getField(RegisteredListener.class, "executor",
					EventExecutor.class);
			EventExecutor executor = field.get(listener);
			if (executor instanceof EventExecutorInjector) {
				EventExecutorInjector eventExecutorInjector = (EventExecutorInjector) executor;
				String eventName = eventExecutorInjector.getEventName();
				if (eventName != null) {
					MonitorRecord monitorRecord = getMonitorRecord(eventName, eventExecutorInjector.getTotalTime(),
							eventExecutorInjector.getTotalCount(), eventExecutorInjector.getMaxExecuteTime());
					if (record.containsKey(eventName)) {
						MonitorRecord otherMonitorRecord = record.get(eventName);
						record.put(eventName, otherMonitorRecord.merge(monitorRecord));
					} else {
						record.put(eventName, monitorRecord);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	return record;
}
 
开发者ID:GelandiAssociation,项目名称:EscapeLag,代码行数:31,代码来源:MonitorUtils.java

示例14: displayOptions

import java.util.Map; //导入方法依赖的package包/类
private void displayOptions(PrintStream out, StringPattern sp, boolean non_defaults)
{
	sp.setIgnoreCase(true);
	Iterator I = non_defaults?COConfigurationManager.getDefinedParameters().iterator():COConfigurationManager.getAllowedParameters().iterator();
	Map backmap = new HashMap();
	for (Iterator iter = ExternalUIConst.parameterlegacy.entrySet().iterator(); iter.hasNext();) {
		Map.Entry entry = (Map.Entry) iter.next();
		backmap.put( entry.getValue(), entry.getKey() );
	}
	TreeSet srt = new TreeSet();
	while (I.hasNext()) {
		String internal_name = (String) I.next();

		String	external_name = (String) backmap.get(internal_name);

		if ( external_name == null ){

			external_name = internal_name;
		}
		if( sp.matches(external_name) )
		{
			Parameter param = Parameter.get( internal_name, external_name );

			if ( non_defaults ){

				if ( !param.isDefault()){

					srt.add( param.getString( true ));
				}
			}else{

				srt.add( param.getString( false ));
			}
		}
	}
	I = srt.iterator();
	while (I.hasNext()) {
		out.println((String) I.next());
	}
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:41,代码来源:Set.java

示例15: FixedMap

import java.util.Map; //导入方法依赖的package包/类
/**
 * Constructs a new fixed map from the given map.
 * @ensures this.keys' = keys && this.map = map.map
 */
public FixedMap(Map<K, V> map) {
	this(map.keySet());
	for(int i = 0, size = map.size(); i < size; i++) {
		values[i] = map.get(keys[i]);
	}
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:11,代码来源:FixedMap.java


注:本文中的java.util.Map.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。