久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

找到保存最小整數(shù)值的 HashMap 的鍵

Finding the key of HashMap which holds the lowest integer value(找到保存最小整數(shù)值的 HashMap 的鍵)
本文介紹了找到保存最小整數(shù)值的 HashMap 的鍵的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我正在為需要學(xué)習(xí)最常用單詞的年輕學(xué)生創(chuàng)建一個(gè)教育游戲.我隨機(jī)選擇列表中的三個(gè)單詞,將它們顯示在屏幕上,播放三個(gè)單詞之一的錄音,然后學(xué)生必須選擇已經(jīng)發(fā)音的單詞.我記錄了他們每個(gè)單詞猜了多少次.通過(guò)這種方式,我可以為何時(shí)應(yīng)該向?qū)W生介紹新單詞設(shè)置一個(gè)標(biāo)準(zhǔn).When three of the words are picked I'll like to pronounce the word that the student has had least exposure to.

I'm creating an educational game for young students who needs to learn the most common words. On random I pick three words of the list, show them on the screen, play an audio recording of one of the three words and then the student has to pick the word that has been pronounced. I keep track of how many times they have guessed each word. In that way I can set up a criteria for when new words should be introduced to the student. When three of the words are picked I'll like to pronounce the word that the student has had least exposure to.

我有一個(gè)名為 words 的 HashMap,其中包含單詞,以及學(xué)生猜出單詞的次數(shù)的整數(shù)值.

I have a HashMap called words, which contains the words, and a integer value of how many times the student guessed the word.

  HashMap<String,Integer>  words 

它包含 10 - 120 個(gè)鍵/詞.我想創(chuàng)建一個(gè)方法,它將三個(gè)哈希映射鍵作為參數(shù),它可以返回具有最低要求鍵值的字符串/鍵.

It contains between 10 - 120 keys/words. I'll like to create a method, which takes three of the hash map keys as parameters, that can return the String/key having the lowest value of the keys asked for.

我很難讓它按預(yù)期工作,如果能提供任何幫助,我將不勝感激.

I have had trouple getting this to work as intended and I'd appreciate any help.

推薦答案

這個(gè)怎么樣?

private String getMinKey(Map<String, Integer> map, String... keys) {
    String minKey = null;
    int minValue = Integer.MAX_VALUE;
    for(String key : keys) {
        int value = map.get(key);
        if(value < minValue) {
            minValue = value;
            minKey = key;
        }
    }
    return minKey;
}

這篇關(guān)于找到保存最小整數(shù)值的 HashMap 的鍵的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Convert List of Strings into Map using Java-8 Streams API(使用 Java-8 Streams API 將字符串列表轉(zhuǎn)換為 Map)
Getting data from JSON(從 JSON 獲取數(shù)據(jù))
java linkedhashmap iteration(javalinkedhashmap迭代)
Converting a list of objects to Map(將對(duì)象列表轉(zhuǎn)換為 Map)
Create a HashMap with a fixed Key corresponding to a HashSet. point of departure(用一個(gè)固定的Key對(duì)應(yīng)一個(gè)HashSet創(chuàng)建一個(gè)HashMap.出發(fā)點(diǎn))
HttpMessageConverter exception : RestClientException: Could not write request: no suitable HttpMessageConverter found(HttpMessageConverter 異常:RestClientException:無(wú)法寫(xiě)入請(qǐng)求:找不到合適的 HttpMessageConverter) - IT屋-程序員
主站蜘蛛池模板: 国产精品中文字幕在线 | 亚洲一区在线日韩在线深爱 | 超碰在线97国产 | 欧美日韩在线一区二区 | 国产资源在线播放 | 综合色播| 亚洲视频欧美视频 | 日韩aⅴ在线观看 | 欧美一区二区三区在线观看 | 欧美日韩亚洲国产 | 一区二区免费 | 二区在线视频 | 九九国产 | 免费簧片视频 | 国产成人福利在线观看 | 成人1区2区 | 国产久 | www.888www看片 | 日韩一区二区三区视频 | 亚洲精品一区二区在线 | 亚洲高清网| 中文字幕 亚洲一区 | 香蕉视频91 | 人和拘一级毛片c | 亚洲日韩第一页 | 国产精品久久久久久一级毛片 | 国产激情片在线观看 | 久久亚洲视频网 | 日韩男人天堂 | 国产91精品在线 | 国产精品一区二区在线播放 | 成人午夜免费福利视频 | 人人干97| 久久久久免费精品国产小说色大师 | 午夜久久久久久久久久一区二区 | 懂色tv| 福利网站在线观看 | 国产亚洲第一页 | 午夜视频在线免费观看 | 99精品免费久久久久久日本 | 日韩欧美在线观看 |