本文整理汇总了Java中java.util.AbstractMap.SimpleEntry.getKey方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleEntry.getKey方法的具体用法?Java SimpleEntry.getKey怎么用?Java SimpleEntry.getKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.AbstractMap.SimpleEntry
的用法示例。
在下文中一共展示了SimpleEntry.getKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseCondition
import java.util.AbstractMap.SimpleEntry; //导入方法依赖的package包/类
private SimpleEntry<String, Integer> parseCondition(byte[] input, int index) {
String result = "";
int advance = 2;
int length = (int) ScriptUtils.shortFromByteArray(input, index + 1);
if (input[index] == 0x49)
result += "fail {";
else if (input[index] == 0x4C)
result += "pass {";
else if (input[index] == 0x4D)
result += "specialCheck {";
else if (input[index] == 0x4B)
result += "unknownCheck {";
SimpleEntry<Boolean, Integer> endData = hasEndConditional(input);
conditionalLengths.push(length);
conditionalIndexes.push(index + 1);
SimpleEntry<Boolean, Integer> newEndData = hasEndConditional(input);
if (endData.getKey() && newEndData.getKey()) // Special case scenario for A028 and B028.
{
if (endData.getValue().intValue() == newEndData.getValue().intValue() && length == 5) {
conditionalLengths.pop();
conditionalIndexes.pop();
conditionalLengths.push(length - 3);
conditionalIndexes.push(index + 1);
specialCaseStack.push(true);
return new SimpleEntry<>(result, advance);
}
}
specialCaseStack.push(false);
return new SimpleEntry<>(result, advance);
}
示例2: dumpParameters
import java.util.AbstractMap.SimpleEntry; //导入方法依赖的package包/类
private void dumpParameters() {
String result;
for (SimpleEntry<String, Integer> s : parameters) {
int index = s.getValue();
savedPoints.replace(index, decompiled.size());
result = getWhiteSpace() + s.getKey();
decompiled.add(result);
}
parameters.clear();
}
示例3: processConditionals
import java.util.AbstractMap.SimpleEntry; //导入方法依赖的package包/类
private void processConditionals(byte[] input, int currentIndex) {
if (conditionalLengths.size() > 0 && conditionalIndexes.size() > 0) // If the stack size is 0 we don't need to worry about adding in spaces.
{
int currentConditionalLength = conditionalLengths.peek();
int currentConditionalIndex = conditionalIndexes.peek();
SimpleEntry<Boolean, Integer> endData = hasEndConditional(input);
if (endData.getKey() && endData.getValue() == currentIndex) {
breakNest();
} else if ((currentConditionalIndex + currentConditionalLength) <= currentIndex) {
if (currentIndex + 3 < input.length) // Fix for P006.
{
if (input[currentIndex] == 0x49 && input[currentIndex + 0x3] == 0x49) {
short value = ScriptUtils.shortFromByteArray(input, currentIndex + 1);
if (value > 0)
omitFlag = true;
}
}
breakNest();
if (conditionalLengths.size() > 0) // Fix for B027 and B028.
{
int nextConditionalLength = conditionalLengths.pop();
int nextConditionalIndex = conditionalIndexes.pop();
int thirdConditionalLength;
int thirdConditionalIndex;
if (reductionNumber != -1) {
currentConditionalLength += reductionNumber;
reductionNumber = -1;
}
int extraLength = (currentConditionalLength + currentConditionalIndex) - (nextConditionalIndex + nextConditionalLength);
if (extraLength > 0) {
decompiled.add(getWhiteSpace() + "reduce(" + Long.toHexString(extraLength) + ")");
if (conditionalLengths.size() > 0) {
thirdConditionalLength = conditionalLengths.peek();
thirdConditionalIndex = conditionalIndexes.peek();
extraLength = (currentConditionalLength + currentConditionalIndex) - (thirdConditionalIndex + thirdConditionalLength);
if (extraLength > 0) {
reductionNumber = extraLength;
}
}
}
conditionalLengths.push(nextConditionalLength);
conditionalIndexes.push(nextConditionalIndex);
}
processConditionals(input, currentIndex);
}
}
}
示例4: encodeObjectAsQueryString
import java.util.AbstractMap.SimpleEntry; //导入方法依赖的package包/类
/**
* Encodes a given object to url encoded string
* @param name
* @param obj
* @param objBuilder
*/
private static void encodeObjectAsQueryString(
String name,
Object obj,
StringBuilder objBuilder)
{
try
{
if(obj == null)
return;
List<SimpleEntry<String, Object>> objectList = new ArrayList<SimpleEntry<String, Object>>();
objectToList(name, obj, objectList, new HashSet<Integer>());
boolean hasParam = false;
for (SimpleEntry<String, Object> pair : objectList)
{
String paramKeyValPair;
String accessor = pair.getKey();
//ignore nulls
Object value = pair.getValue();
if(value == null)
continue;
hasParam = true;
//load element value as string
paramKeyValPair = String.format("%s=%s&", accessor, tryUrlEncode(value.toString()));
objBuilder.append(paramKeyValPair);
}
//remove the last &
if(hasParam)
{
objBuilder.setLength(objBuilder.length() - 1);
}
}
catch (Exception ex)
{
}
}
示例5: initialize
import java.util.AbstractMap.SimpleEntry; //导入方法依赖的package包/类
private void initialize(
Map<HRegionLocation, FlushWorker> serverToFlushWorkerMap) {
if (serverToFlushWorkerMap == null) {
return;
}
long averageCalcSum = 0;
int averageCalcCount = 0;
for (Map.Entry<HRegionLocation, FlushWorker> entry : serverToFlushWorkerMap
.entrySet()) {
HRegionLocation addr = entry.getKey();
FlushWorker worker = entry.getValue();
long bufferedCounter = worker.getTotalBufferedCount();
long failedCounter = worker.getTotalFailedCount();
long serverMaxLatency = worker.getMaxLatency();
AtomicAverageCounter averageCounter = worker.getAverageLatencyCounter();
// Get sum and count pieces separately to compute overall average
SimpleEntry<Long, Integer> averageComponents = averageCounter
.getComponents();
long serverAvgLatency = averageCounter.getAndReset();
this.totalBufferedPutCounter += bufferedCounter;
this.totalFailedPutCounter += failedCounter;
if (serverMaxLatency > this.maxLatency) {
this.maxLatency = serverMaxLatency;
}
averageCalcSum += averageComponents.getKey();
averageCalcCount += averageComponents.getValue();
this.serverToBufferedCounterMap.put(addr.getHostnamePort(),
bufferedCounter);
this.serverToFailedCounterMap
.put(addr.getHostnamePort(),
failedCounter);
this.serverToAverageLatencyMap.put(addr.getHostnamePort(),
serverAvgLatency);
this.serverToMaxLatencyMap
.put(addr.getHostnamePort(),
serverMaxLatency);
}
this.overallAverageLatency = averageCalcCount != 0 ? averageCalcSum
/ averageCalcCount : 0;
}