當前位置: 首頁>>代碼示例>>Java>>正文


Java Entry.getKey方法代碼示例

本文整理匯總了Java中java.util.Map.Entry.getKey方法的典型用法代碼示例。如果您正苦於以下問題:Java Entry.getKey方法的具體用法?Java Entry.getKey怎麽用?Java Entry.getKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Map.Entry的用法示例。


在下文中一共展示了Entry.getKey方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: encode

import java.util.Map.Entry; //導入方法依賴的package包/類
@Override
protected void encode(ChannelHandlerContext channelHandlerContext, HTTPResponse response,
	ByteBuf byteBuf) throws Exception {
	System.out.println("Response: " + response);
	
	String statusResponse = HTTP_VERSION + " "
		+ response.getStatus().getCode() + " "
		+ response.getStatus().getDescription() + new String(NEW_LINE);
	
	byteBuf.writeBytes(statusResponse.getBytes(CharsetUtil.UTF_8));
	
	for (Entry<String, String> entry : response.getHeaders().getHandle().entrySet()) {
		String line = entry.getKey() + ": " + entry.getValue();
		byteBuf.writeBytes(line.getBytes(CharsetUtil.UTF_8));
		byteBuf.writeBytes(NEW_LINE);
	}
	
	byteBuf.writeBytes(NEW_LINE);
	
	byteBuf.writeBytes(response.getBody().getHandle());
}
 
開發者ID:D3adspaceEnterprises,項目名稱:echidna,代碼行數:22,代碼來源:HTTPEncoder.java

示例2: testRemovePropagatesToAsMap

import java.util.Map.Entry; //導入方法依賴的package包/類
@MapFeature.Require(SUPPORTS_REMOVE)
@CollectionSize.Require(absent = ZERO)
public void testRemovePropagatesToAsMap() {
  List<Entry<K, V>> entries = Helpers.copyToList(multimap().entries());
  for (Entry<K, V> entry : entries) {
    resetContainer();

    K key = entry.getKey();
    V value = entry.getValue();
    Collection<V> collection = multimap().asMap().get(key);
    assertNotNull(collection);
    Collection<V> expectedCollection = Helpers.copyToList(collection);

    multimap().remove(key, value);
    expectedCollection.remove(value);

    assertEqualIgnoringOrder(expectedCollection, collection);
    assertEquals(!expectedCollection.isEmpty(), multimap().containsKey(key));
  }
}
 
開發者ID:paul-hammant,項目名稱:googles-monorepo-demo,代碼行數:21,代碼來源:MultimapRemoveEntryTester.java

示例3: getUnitTopics

import java.util.Map.Entry; //導入方法依賴的package包/類
public byte[] getUnitTopics() {
    TopicList topicList = new TopicList();
    try {
        try {
            this.lock.readLock().lockInterruptibly();
            Iterator<Entry<String, List<QueueData>>> topicTableIt =
                this.topicQueueTable.entrySet().iterator();
            while (topicTableIt.hasNext()) {
                Entry<String, List<QueueData>> topicEntry = topicTableIt.next();
                String topic = topicEntry.getKey();
                List<QueueData> queueDatas = topicEntry.getValue();
                if (queueDatas != null && queueDatas.size() > 0
                    && TopicSysFlag.hasUnitFlag(queueDatas.get(0).getTopicSynFlag())) {
                    topicList.getTopicList().add(topic);
                }
            }
        } finally {
            this.lock.readLock().unlock();
        }
    } catch (Exception e) {
        log.error("getAllTopicList Exception", e);
    }

    return topicList.encode();
}
 
開發者ID:lirenzuo,項目名稱:rocketmq-rocketmq-all-4.1.0-incubating,代碼行數:26,代碼來源:RouteInfoManager.java

示例4: setData

import java.util.Map.Entry; //導入方法依賴的package包/類
/**
 * Gives this table model the data that is being used in the
 * table. This method should only be called to initialize the
 * data set. To modify or extend the data set use other
 * methods.
 *
 * @param statsData The map of key,value pairs to enter.
 */
public void setData(java.util.Map<String, String> statsData) {
    this.data = new Object[2][statsData.size()];
    int i = 0;
    for (Entry<String, String> e : mapEntriesByKey(statsData)) {
        data[NAME_COLUMN][i] = e.getKey();
        data[VALUE_COLUMN][i] = e.getValue();
        i++;
    }
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:18,代碼來源:StatisticsPanel.java

示例5: updateUserDetails

import java.util.Map.Entry; //導入方法依賴的package包/類
private void updateUserDetails(Entry<String, Object> entry) {
  String userId = entry.getKey();
  ProjectLogger.log("updating user data started");
  Map<String, Object> userMap = (Map<String, Object>) entry.getValue();
  // Decrypt user data
  UserUtility.decryptUserData(userMap);
  Util.DbInfo dbInfo = Util.dbInfoMap.get(JsonKey.USER_DB);
  if(isSSOEnabled){
    try {
      String res = ssoManager.syncUserData(userMap);
      if (!(!ProjectUtil.isStringNullOREmpty(res) && res.equalsIgnoreCase(JsonKey.SUCCESS))) {
        if(null == userMap.get(JsonKey.EMAIL_VERIFIED)){
          Map<String,Object> map = new HashMap<>();
         if(SSOServiceFactory.getInstance().isEmailVerified(userId)){
           map.put(JsonKey.EMAIL_VERIFIED, true);
           map.put(JsonKey.ID, userId);
         }else{
           map.put(JsonKey.EMAIL_VERIFIED, false);
           map.put(JsonKey.ID, userId);
         }
         cassandraOperation.updateRecord(dbInfo.getKeySpace(), dbInfo.getTableName(), map);
         ElasticSearchUtil.updateData(ProjectUtil.EsIndex.sunbird.getIndexName(),
             ProjectUtil.EsType.user.getTypeName(), userId, map);
        }
        ProjectLogger.log("User sync failed in KeyCloakSyncActor for userID : "+ userId);
      }
    } catch (Exception e) {
      ProjectLogger.log(e.getMessage(), e);
      ProjectLogger.log("User sync failed in KeyCloakSyncActor for userID : "+ userId);
    }
  }else{
    ProjectLogger.log("SSO is disabled , cann't sync user data to keycloak.");
  }
}
 
開發者ID:project-sunbird,項目名稱:sunbird-lms-mw,代碼行數:35,代碼來源:KeyCloakSyncActor.java

示例6: removeNext

import java.util.Map.Entry; //導入方法依賴的package包/類
/**
 * 移除舊的文件
 * 
 * @return
 */
private long removeNext() {
	if (lastUsageDates.isEmpty()) {
		return 0;
	}

	Long oldestUsage = null;
	File mostLongUsedFile = null;
	Set<Entry<File, Long>> entries = lastUsageDates.entrySet();
	synchronized (lastUsageDates) {
		for (Entry<File, Long> entry : entries) {
			if (mostLongUsedFile == null) {
				mostLongUsedFile = entry.getKey();
				oldestUsage = entry.getValue();
			} else {
				Long lastValueUsage = entry.getValue();
				if (lastValueUsage < oldestUsage) {
					oldestUsage = lastValueUsage;
					mostLongUsedFile = entry.getKey();
				}
			}
		}
	}

	long fileSize = calculateSize(mostLongUsedFile);
	if (mostLongUsedFile.delete()) {
		lastUsageDates.remove(mostLongUsedFile);
	}
	return fileSize;
}
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:35,代碼來源:ACache.java

示例7: createActionsList

import java.util.Map.Entry; //導入方法依賴的package包/類
private List<CalendarState.Action> createActionsList(Map<CalendarDateRange, Set<Action>> actionMap) {

        if (actionMap.isEmpty()) {
            return null;
        }

        List<CalendarState.Action> calendarActions = new ArrayList<>();

        for (Entry<CalendarDateRange, Set<Action>> entry : actionMap.entrySet()) {

            CalendarDateRange range = entry.getKey();

            for (Action action : entry.getValue()) {
                String key = actionMapper.key(action);
                CalendarState.Action calendarAction = new CalendarState.Action();
                calendarAction.actionKey = key;
                calendarAction.caption = action.getCaption();
                setResource(key, action.getIcon());
                calendarAction.iconKey = key;
                calendarAction.startDate = ACTION_DATE_TIME_FORMAT.format(range.getStart());
                calendarAction.endDate = ACTION_DATE_TIME_FORMAT.format(range.getEnd());
                calendarActions.add(calendarAction);
            }
        }

        return calendarActions;
    }
 
開發者ID:blackbluegl,項目名稱:calendar-component,代碼行數:28,代碼來源:Calendar.java

示例8: writeObject

import java.util.Map.Entry; //導入方法依賴的package包/類
/**
 * @serialData Null terminated list of <code>VetoableChangeListeners</code>.
 * <p>
 * At serialization time we skip non-serializable listeners and
 * only serialize the serializable listeners.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
    Hashtable<String, VetoableChangeSupport> children = null;
    VetoableChangeListener[] listeners = null;
    synchronized (this.map) {
        for (Entry<String, VetoableChangeListener[]> entry : this.map.getEntries()) {
            String property = entry.getKey();
            if (property == null) {
                listeners = entry.getValue();
            } else {
                if (children == null) {
                    children = new Hashtable<>();
                }
                VetoableChangeSupport vcs = new VetoableChangeSupport(this.source);
                vcs.map.set(null, entry.getValue());
                children.put(property, vcs);
            }
        }
    }
    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("children", children);
    fields.put("source", this.source);
    fields.put("vetoableChangeSupportSerializedDataVersion", 2);
    s.writeFields();

    if (listeners != null) {
        for (VetoableChangeListener l : listeners) {
            if (l instanceof Serializable) {
                s.writeObject(l);
            }
        }
    }
    s.writeObject(null);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:40,代碼來源:VetoableChangeSupport.java

示例9: getConfiguredNodeLabels

import java.util.Map.Entry; //導入方法依賴的package包/類
/**
 * Get configured node labels in a given queuePath
 */
public Set<String> getConfiguredNodeLabels(String queuePath) {
  Set<String> configuredNodeLabels = new HashSet<String>();
  Entry<String, String> e = null;
  
  Iterator<Entry<String, String>> iter = iterator();
  while (iter.hasNext()) {
    e = iter.next();
    String key = e.getKey();

    if (key.startsWith(getQueuePrefix(queuePath) + ACCESSIBLE_NODE_LABELS
        + DOT)) {
      // Find <label-name> in
      // <queue-path>.accessible-node-labels.<label-name>.property
      int labelStartIdx =
          key.indexOf(ACCESSIBLE_NODE_LABELS)
              + ACCESSIBLE_NODE_LABELS.length() + 1;
      int labelEndIndx = key.indexOf('.', labelStartIdx);
      String labelName = key.substring(labelStartIdx, labelEndIndx);
      configuredNodeLabels.add(labelName);
    }
  }
  
  // always add NO_LABEL
  configuredNodeLabels.add(RMNodeLabelsManager.NO_LABEL);
  
  return configuredNodeLabels;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:31,代碼來源:CapacitySchedulerConfiguration.java

示例10: removeNext

import java.util.Map.Entry; //導入方法依賴的package包/類
/**
 * 移除舊的文件
 */
private long removeNext() {
    if (lastUsageDates.isEmpty()) {
        return 0;
    }

    Long oldestUsage = null;
    File mostLongUsedFile = null;
    Set<Entry<File, Long>> entries = lastUsageDates.entrySet();
    synchronized (lastUsageDates) {
        for (Entry<File, Long> entry : entries) {
            if (mostLongUsedFile == null) {
                mostLongUsedFile = entry.getKey();
                oldestUsage = entry.getValue();
            } else {
                Long lastValueUsage = entry.getValue();
                if (lastValueUsage < oldestUsage) {
                    oldestUsage = lastValueUsage;
                    mostLongUsedFile = entry.getKey();
                }
            }
        }
    }

    long fileSize = calculateSize(mostLongUsedFile);
    if (mostLongUsedFile.delete()) {
        lastUsageDates.remove(mostLongUsedFile);
    }
    return fileSize;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:33,代碼來源:ACache.java

示例11: getCombinerOutput

import java.util.Map.Entry; //導入方法依賴的package包/類
/**
 *  @return a list value/frequence pairs.
 *  The return value is expected to be used by the reducer.
 */
public ArrayList<String> getCombinerOutput() {
  ArrayList<String> retv = new ArrayList<String>();
  Iterator<Entry<Object,Object>> iter = items.entrySet().iterator();

  while (iter.hasNext()) {
    Entry<Object,Object> en =  iter.next();
    Object val = en.getKey();
    Long count = (Long) en.getValue();
    retv.add(val.toString() + "\t" + count.longValue());
  }
  return retv;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:17,代碼來源:ValueHistogram.java

示例12: instant

import java.util.Map.Entry; //導入方法依賴的package包/類
@Override
public void instant(L2Character effector, L2Character effected, Skill skill, L2ItemInstance item)
{
	if (_dispelAbnormals.isEmpty())
	{
		return;
	}
	
	final CharEffectList effectList = effected.getEffectList();
	// There is no need to iterate over all buffs,
	// Just iterate once over all slots to dispel and get the buff with that abnormal if exists,
	// Operation of O(n) for the amount of slots to dispel (which is usually small) and O(1) to get the buff.
	for (Entry<AbnormalType, Short> entry : _dispelAbnormals.entrySet())
	{
		// Dispel transformations (buff and by GM)
		if ((entry.getKey() == AbnormalType.TRANSFORM))
		{
			if ((entry.getValue() == effected.getTransformationId()) || (entry.getValue() < 0))
			{
				effected.stopTransformation(true);
				continue;
			}
		}
		
		final BuffInfo toDispel = effectList.getBuffInfoByAbnormalType(entry.getKey());
		if (toDispel == null)
		{
			continue;
		}
		
		if ((entry.getKey() == toDispel.getSkill().getAbnormalType()) && ((entry.getValue() < 0) || (entry.getValue() >= toDispel.getSkill().getAbnormalLvl())))
		{
			effectList.stopSkillEffects(true, entry.getKey());
		}
	}
}
 
開發者ID:rubenswagner,項目名稱:L2J-Global,代碼行數:37,代碼來源:DispelBySlot.java

示例13: rebuildHashesFromStrings

import java.util.Map.Entry; //導入方法依賴的package包/類
/**
 * Rebuilds a map of identified Uniform Fuzzy Hashes from a map of identified strings
 * representing them.
 * 
 * @param <T> Identifiers type.
 * @param strings Map of identified strings representing Uniform Fuzzy Hashes.
 * @return Map of identified Uniform Fuzzy Hashes.
 */
public static <T> Map<T, UniformFuzzyHash> rebuildHashesFromStrings(
        Map<T, String> strings) {

    if (strings == null) {
        throw new NullPointerException("Map of hash strings is null.");
    }

    Set<Entry<T, String>> entries = strings.entrySet();
    Map<T, UniformFuzzyHash> hashes = new LinkedHashMap<>(entries.size());

    for (Entry<T, String> entry : entries) {

        T identifier = entry.getKey();
        String hashString = entry.getValue();

        if (hashString == null) {
            hashes.put(identifier, null);
            continue;
        }

        UniformFuzzyHash hash = null;
        try {
            hash = UniformFuzzyHash.rebuildFromString(hashString);
        } catch (IllegalArgumentException illegalArgumentException) {
            throw new IllegalArgumentException(String.format(
                    "Hash %s could not be parsed. %s",
                    identifier,
                    illegalArgumentException.getMessage()));
        }
        hashes.put(identifier, hash);

    }

    return hashes;

}
 
開發者ID:s3curitybug,項目名稱:similarity-uniform-fuzzy-hash,代碼行數:45,代碼來源:UniformFuzzyHashes.java

示例14: getPublicPackagesForPlugin

import java.util.Map.Entry; //導入方法依賴的package包/類
/**
 * Transforms public packages in form of "selected items" map into
 * set of strings describing public packages in maven-nbm-plugin syntax.
 */
public static SortedSet<String> getPublicPackagesForPlugin (SortedMap<String, Boolean> selItems) {
    SortedSet<String> result = new TreeSet<String>();
    Set<String> processed = new HashSet<String>();
    for (Entry<String, Boolean> entry : selItems.entrySet()) {
        if (entry.getValue() && !processed.contains(entry.getKey())) {
            boolean allSubpackages = true;
            Set<String> processedCandidates = new HashSet<String>();
            String prefix = entry.getKey() + ".";
            for (String key : selItems.keySet()) {
                if (key.startsWith(prefix)) {
                    if (selItems.get(key)) {
                        processedCandidates.add(key);
                    } else {
                        allSubpackages = false;
                        break;
                    }
                }
            }
            if (allSubpackages && processedCandidates.size() > COALESCE_LIMIT) {
                result.add(entry.getKey() + ALL_SUBPACKAGES);
                processed.addAll(processedCandidates);
            } else {
                result.add(entry.getKey());
            }
        }
    }

    return result;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:34,代碼來源:PublicPackagesPanel.java

示例15: updateAllReceivers

import java.util.Map.Entry; //導入方法依賴的package包/類
public void updateAllReceivers()
{
    ((RedstoneEtherServer)ether).updateReceivingDevices(freq, powered);
    
    for(Entry<Integer, DimensionalNodeTracker> entry : nodetrackers.entrySet())
    {
        int dimension = entry.getKey();
        DimensionalNodeTracker tracker = entry.getValue();
        
        useTemporarySet = true;
        for(BlockPos coord : tracker.receiverset)
        {
            updateReceiver(tracker.world, coord, powered);
        }
        useTemporarySet = false;
        
        while(tracker.temporarySet.size() > 0)
        {
            DelayedModification mod = tracker.temporarySet.removeFirst();
            
            if(mod.function == 0)
                remReceiver(tracker.world, mod.coord, dimension);
            else if(mod.function == 1)
                addReceiver(tracker.world, mod.coord, dimension);
            else if(mod.function == 2)
                remTransmitter(tracker.world, mod.coord, dimension);
            else if((mod.function&4)!= 0)
                setTransmitter(tracker.world, mod.coord, dimension, (mod.function&1) != 0);
        }
    }
}
 
開發者ID:TheCBProject,項目名稱:WirelessRedstone,代碼行數:32,代碼來源:RedstoneEtherFrequency.java


注:本文中的java.util.Map.Entry.getKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。