本文整理汇总了Java中java.util.SortedMap.values方法的典型用法代码示例。如果您正苦于以下问题:Java SortedMap.values方法的具体用法?Java SortedMap.values怎么用?Java SortedMap.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.SortedMap
的用法示例。
在下文中一共展示了SortedMap.values方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sortTransformersByName
import java.util.SortedMap; //导入方法依赖的package包/类
/**
* Returns a sorted list of all transformers sorted by name.
* @param transformerName to restrict the collection to one entry
* @return a new Collection of sorted transformers
* @throws IllegalArgumentException if transformerName is not found.
*/
public Collection<ContentTransformer> sortTransformersByName(String transformerName)
{
Collection<ContentTransformer> transformers = (transformerName != null)
? Collections.singleton(transformerRegistry.getTransformer(transformerName))
: transformerRegistry.getAllTransformers();
SortedMap<String, ContentTransformer> map = new TreeMap<String, ContentTransformer>();
for (ContentTransformer transformer: transformers)
{
String name = transformer.getName();
map.put(name, transformer);
}
Collection<ContentTransformer> sorted = map.values();
return sorted;
}
示例2: buildLevels2
import java.util.SortedMap; //导入方法依赖的package包/类
/** Constructs the level2 map. */
private SortedMap<Index,Level2> buildLevels2(SortedMap<Index,Level1> level1Map,
RuleModelMap modelMap) throws FormatException {
SortedMap<Index,Level2> result = new TreeMap<>();
FormatErrorSet errors = createErrors();
for (Level1 level1 : level1Map.values()) {
try {
Index index = level1.getIndex();
Level2 level2 = new Level2(level1, modelMap);
result.put(index, level2);
} catch (FormatException e) {
errors.addAll(e.getErrors());
}
}
errors.throwException();
return result;
}
示例3: whenInputSomeXMLThenParserShouldParseItCorrectly
import java.util.SortedMap; //导入方法依赖的package包/类
/**
* Test SAXParser.
* @throws IOException exceptions produced by failed or
* interrupted I/O operations.
* @throws XMLStreamException unexpected
* processing conditions.
*/
@Test
public void whenInputSomeXMLThenParserShouldParseItCorrectly() throws IOException, XMLStreamException {
StringBuilder builder = new StringBuilder(256);
builder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
builder.append("<Orders>");
builder.append("<AddOrder book=\"book-1\" operation=\"SELL\" price=\"100.50\" volume=\"10\" orderId=\"1\" />");
builder.append("<AddOrder book=\"book-1\" operation=\"BUY\" price=\" 99.40\" volume=\"10\" orderId=\"5\" />");
builder.append("<AddOrder book=\"book-3\" operation=\"BUY\" price=\" 99.50\" volume=\"10\" orderId=\"4\" />");
builder.append("<AddOrder book=\"book-3\" operation=\"SELL\" price=\" 99.50\" volume=\"20\" orderId=\"5\" />");
builder.append("<AddOrder book=\"book-1\" operation=\"SELL\" price=\" 99.50\" volume=\"20\" orderId=\"6\" />");
builder.append("<DeleteOrder book=\"book-1\" orderId=\"1\" />");
builder.append("</Orders>");
ByteArrayInputStream in = new ByteArrayInputStream(builder.toString().getBytes(StandardCharsets.UTF_8.name()));
StAXParser parser = new StAXParser();
SortedMap<String, OrderBook> map = parser.parse(in);
StringBuilder resultBuilder = new StringBuilder();
for (OrderBook ob : map.values()) {
resultBuilder.append(ob.print());
}
System.out.println(resultBuilder);
}
示例4: getBiggestMemstoreOfRegionReplica
import java.util.SortedMap; //导入方法依赖的package包/类
private Region getBiggestMemstoreOfRegionReplica(SortedMap<Long, Region> regionsBySize,
Set<Region> excludedRegions) {
synchronized (regionsInQueue) {
for (Region region : regionsBySize.values()) {
if (excludedRegions.contains(region)) {
continue;
}
if (RegionReplicaUtil.isDefaultReplica(region.getRegionInfo())) {
continue;
}
return region;
}
}
return null;
}
示例5: generatePlugins
import java.util.SortedMap; //导入方法依赖的package包/类
private void generatePlugins(File output) throws BuildException, IOException {
Set<String> standardClusters = new HashSet<>();
String standardClustersS = getProject().getProperty("clusters.config.full.list");
if (standardClustersS != null) {
for (String clusterProp : standardClustersS.split(",")) {
String dir = getProject().getProperty(clusterProp + ".dir");
if (dir != null) {
standardClusters.add(dir.replaceFirst("[0-9.]+$", ""));
}
}
}
try (FileWriter fw = new FileWriter(output)) {
PrintWriter w = new PrintWriter(fw);
SortedMap<String,String> lines = new TreeMap<>(Collator.getInstance());
lines.put("A", "||Code Name Base||Display Name||Display Category||Standard Cluster");
lines.put("C", "");
lines.put("D", "||Code Name Base||Display Name||Display Category||Extra Cluster");
for (ModuleInfo m : modules) {
if (regexp != null && !regexp.matcher(m.group).matches()) {
continue;
}
if (m.showInAutoupdate) {
lines.put((standardClusters.contains(m.group) ? "B" : "E") + m.displayCategory + " " + m.displayName,
"|" + m.codebasename + "|" + m.displayName + "|" + m.displayCategory + "|" + m.group);
}
}
for (String line : lines.values()) {
w.println(line);
}
w.flush();
}
}
示例6: suggestFixes
import java.util.SortedMap; //导入方法依赖的package包/类
/**
* Suggest fixes for each table
*/
private void suggestFixes(
SortedMap<TableName, TableInfo> tablesInfo) throws IOException {
logParallelMerge();
for (TableInfo tInfo : tablesInfo.values()) {
TableIntegrityErrorHandler handler = tInfo.new IntegrityFixSuggester(tInfo, errors);
tInfo.checkRegionChain(handler);
}
}
示例7: getNearestNeighbors
import java.util.SortedMap; //导入方法依赖的package包/类
private static int[] getNearestNeighbors(SortedMap<Double, Integer> distanceMap) {
int[] nearest = new int[6];
int i = 0;
for (Integer index : distanceMap.values()) {
nearest[i++] = index;
if (i >= 6) {
break;
}
}
return nearest;
}
示例8: parseBlock
import java.util.SortedMap; //导入方法依赖的package包/类
static BlockImpl parseBlock(JSONObject blockData) throws NxtException.ValidationException {
try {
int version = ((Long)blockData.get("version")).intValue();
int timestamp = ((Long)blockData.get("timestamp")).intValue();
Long previousBlock = Convert.parseUnsignedLong((String) blockData.get("previousBlock"));
long totalAmountNQT = Convert.parseLong(blockData.get("totalAmountNQT"));
long totalFeeNQT = Convert.parseLong(blockData.get("totalFeeNQT"));
int payloadLength = ((Long)blockData.get("payloadLength")).intValue();
byte[] payloadHash = Convert.parseHexString((String) blockData.get("payloadHash"));
byte[] generatorPublicKey = Convert.parseHexString((String) blockData.get("generatorPublicKey"));
byte[] generationSignature = Convert.parseHexString((String) blockData.get("generationSignature"));
byte[] blockSignature = Convert.parseHexString((String) blockData.get("blockSignature"));
byte[] previousBlockHash = version == 1 ? null : Convert.parseHexString((String) blockData.get("previousBlockHash"));
Long nonce = Convert.parseUnsignedLong((String)blockData.get("nonce"));
SortedMap<Long, TransactionImpl> blockTransactions = new TreeMap<>();
JSONArray transactionsData = (JSONArray)blockData.get("transactions");
for (Object transactionData : transactionsData) {
TransactionImpl transaction = TransactionImpl.parseTransaction((JSONObject) transactionData);
if (blockTransactions.put(transaction.getId(), transaction) != null) {
throw new NxtException.NotValidException("Block contains duplicate transactions: " + transaction.getStringId());
}
}
byte[] blockATs = Convert.parseHexString( (String) blockData.get("blockATs") );
return new BlockImpl(version, timestamp, previousBlock, totalAmountNQT, totalFeeNQT, payloadLength, payloadHash, generatorPublicKey,
generationSignature, blockSignature, previousBlockHash, new ArrayList<>(blockTransactions.values()), nonce , blockATs);
} catch (NxtException.ValidationException|RuntimeException e) {
Logger.logDebugMessage("Failed to parse block: " + blockData.toJSONString());
throw e;
}
}
示例9: buildLevels3
import java.util.SortedMap; //导入方法依赖的package包/类
/** Constructs the level3 map. */
private SortedMap<Index,Level3> buildLevels3(SortedMap<Index,Level2> level2Map,
RuleGraphMorphism typingMap) throws FormatException {
SortedMap<Index,Level3> result = new TreeMap<>();
FormatErrorSet errors = createErrors();
for (Level2 level2 : level2Map.values()) {
Index index = level2.getIndex();
Level3 parent = index.isTopLevel() ? null : result.get(index.getParent());
Level3 level3 = new Level3(level2, parent, typingMap);
result.put(index, level3);
}
errors.throwException();
return result;
}
示例10: build4From3
import java.util.SortedMap; //导入方法依赖的package包/类
/** Constructs the level4 map. */
private SortedMap<Index,Level4> build4From3(SortedMap<Index,Level3> level3Map) {
SortedMap<Index,Level4> result = new TreeMap<>();
for (Level3 level3 : level3Map.values()) {
Index index = level3.getIndex();
Level4 parent = index.isTopLevel() ? null : result.get(index.getParent());
Level4 level4 = new Level4(level3, parent);
result.put(index, level4);
}
return result;
}
示例11: printTableSummary
import java.util.SortedMap; //导入方法依赖的package包/类
/**
* Prints summary of all tables found on the system.
*/
private void printTableSummary(SortedMap<TableName, TableInfo> tablesInfo) {
StringBuilder sb = new StringBuilder();
int numOfSkippedRegions;
errors.print("Summary:");
for (TableInfo tInfo : tablesInfo.values()) {
numOfSkippedRegions = (skippedRegions.containsKey(tInfo.getName())) ?
skippedRegions.get(tInfo.getName()).size() : 0;
if (errors.tableHasErrors(tInfo)) {
errors.print("Table " + tInfo.getName() + " is inconsistent.");
} else if (numOfSkippedRegions > 0){
errors.print("Table " + tInfo.getName() + " is okay (with "
+ numOfSkippedRegions + " skipped regions).");
}
else {
errors.print("Table " + tInfo.getName() + " is okay.");
}
errors.print(" Number of regions: " + tInfo.getNumRegions());
if (numOfSkippedRegions > 0) {
Set<String> skippedRegionStrings = skippedRegions.get(tInfo.getName());
System.out.println(" Number of skipped regions: " + numOfSkippedRegions);
System.out.println(" List of skipped regions:");
for(String sr : skippedRegionStrings) {
System.out.println(" " + sr);
}
}
sb.setLength(0); // clear out existing buffer, if any.
sb.append(" Deployed on: ");
for (ServerName server : tInfo.deployedOn) {
sb.append(" " + server.toString());
}
errors.print(sb.toString());
}
}
示例12: main
import java.util.SortedMap; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, ParserConfigurationException, SAXException {
DOMParser dp = new DOMParser();
long start = System.currentTimeMillis();
SortedMap<String, OrderBook> books = dp.parse(new FileInputStream("C:\\projects\\orders.xml"));
StringBuilder builder = new StringBuilder(1024);
for (OrderBook book : books.values()) {
builder.append(book.print());
}
System.out.println(builder);
System.out.println(System.currentTimeMillis() - start);
}
示例13: retake
import java.util.SortedMap; //导入方法依赖的package包/类
private ActionForward retake(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
AnswerForm answerForm = (AnswerForm) form;
Integer questionSeqID = answerForm.getQuestionSeqID();
String sessionMapID = answerForm.getSessionMapID();
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
.getAttribute(sessionMapID);
SortedMap<Integer, AnswerDTO> surveyItemMap = getQuestionList(sessionMap);
Collection<AnswerDTO> surveyItemList = surveyItemMap.values();
if ( surveyItemList.size() < 2 || ( questionSeqID != null && questionSeqID > 0 ) ) {
answerForm.setPosition(SurveyConstants.POSITION_ONLY_ONE);
} else {
answerForm.setPosition(SurveyConstants.POSITION_FIRST);
}
if ( questionSeqID == null || questionSeqID <= 0 ) {
Boolean onePage = (Boolean) sessionMap.get(SurveyConstants.ATTR_SHOW_ON_ONE_PAGE);
if ( ! onePage && surveyItemList.size() > 0) {
answerForm.setQuestionSeqID(surveyItemMap.firstKey());
questionSeqID = surveyItemMap.firstKey();
}
}
// get current question index of total questions
int currIdx = new ArrayList<Integer>(surveyItemMap.keySet()).indexOf(questionSeqID) + 1;
answerForm.setCurrentIdx(currIdx);
return mapping.findForward(SurveyConstants.SUCCESS);
}
示例14: getToolOutputDefinitions
import java.util.SortedMap; //导入方法依赖的package包/类
/**
* @see org.lamsfoundation.lams.authoring.service.IAuthoringService#getToolOutputDefinitions(java.lang.Long, int)
*/
@Override
public List<ToolOutputDefinitionDTO> getToolOutputDefinitions(Long toolContentID, int definitionType) {
SortedMap<String, ToolOutputDefinition> defns = lamsCoreToolService.getOutputDefinitionsFromTool(toolContentID,
definitionType);
ArrayList<ToolOutputDefinitionDTO> defnDTOList = new ArrayList<>(defns != null ? defns.size() : 0);
if (defns != null) {
for (ToolOutputDefinition defn : defns.values()) {
defnDTOList.add(new ToolOutputDefinitionDTO(defn));
}
}
return defnDTOList;
}
示例15: playLetters
import java.util.SortedMap; //导入方法依赖的package包/类
/**
* Plays the given letters on the board, after checking all the placed letters respect the Scrabble rules
*
* @param playedLetters All the letters of the board, with the new letters placed by the user
*/
public void playLetters(SortedMap<BoardPosition, LetterInterface> playedLetters) throws InvalidPlayedTurnException {
for (LetterInterface playedLetter : playedLetters.values()) {
if (!(playedLetter instanceof Joker)) {
continue;
}
Optional<String> representedLetterString = this.showRepresentedLetterByJokerSelectorDialog();
try {
// noinspection OptionalGetWithoutIsPresent
((Joker) playedLetter).setRepresentedLetter(LetterToStringTransformer.reverseTransform(representedLetterString.get().toUpperCase(), this.getLanguage()));
} catch (Exception e) {
throw new InvalidPlayedTurnException("exceptions.invalidPlayedTurn.jokerValueNonExistent");
}
}
List<WordInterface> playedWords = PlayedTurnValidityChecker.findPlayedWords(this.getLanguage().getDictionary(), this.board, playedLetters, this.getCurrentPlayer());
this.board.addLetters(playedLetters);
this.board.addWords(playedWords);
this.getCurrentPlayer().increaseScore(ScoreManager.getTurnScore(playedLetters.values(), playedWords, this.getBoard()));
this.getCurrentPlayer().removeLetters(playedLetters.values());
this.giveLettersToCurrentPlayerToFillHisRack();
this.reinitializeSkippedTurns();
this.nextTurn();
}