當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。