当前位置: 首页>>代码示例>>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;未经允许,请勿转载。