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

找到保存最小整數值的 HashMap 的鍵

Finding the key of HashMap which holds the lowest integer value(找到保存最小整數值的 HashMap 的鍵)
本文介紹了找到保存最小整數值的 HashMap 的鍵的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在為需要學習最常用單詞的年輕學生創建一個教育游戲.我隨機選擇列表中的三個單詞,將它們顯示在屏幕上,播放三個單詞之一的錄音,然后學生必須選擇已經發音的單詞.我記錄了他們每個單詞猜了多少次.通過這種方式,我可以為何時應該向學生介紹新單詞設置一個標準.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.

我有一個名為 words 的 HashMap,其中包含單詞,以及學生猜出單詞的次數的整數值.

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 個鍵/詞.我想創建一個方法,它將三個哈希映射鍵作為參數,它可以返回具有最低要求鍵值的字符串/鍵.

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.

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

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

推薦答案

這個怎么樣?

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;
}

這篇關于找到保存最小整數值的 HashMap 的鍵的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

Convert List of Strings into Map using Java-8 Streams API(使用 Java-8 Streams API 將字符串列表轉換為 Map)
Getting data from JSON(從 JSON 獲取數據)
java linkedhashmap iteration(javalinkedhashmap迭代)
Converting a list of objects to Map(將對象列表轉換為 Map)
Create a HashMap with a fixed Key corresponding to a HashSet. point of departure(用一個固定的Key對應一個HashSet創建一個HashMap.出發點)
HttpMessageConverter exception : RestClientException: Could not write request: no suitable HttpMessageConverter found(HttpMessageConverter 異常:RestClientException:無法寫入請求:找不到合適的 HttpMessageConverter) - IT屋-程序員
主站蜘蛛池模板: 久久尤物免费一区二区三区 | 亚洲精品一区在线观看 | 婷婷成人在线 | 国产精品免费看 | 亚洲综合中文字幕在线观看 | 国产精品精品久久久 | 黄色国产在线播放 | 一区二区视频 | 国产精品一区二区av | 黄色中文字幕 | 国产一二三区精品视频 | 久久亚洲国产精品 | 成人在线视频网站 | 久久精品国产99国产精品 | 亚洲美女在线视频 | 黄色在线免费网站 | 国产精品精品久久久 | 免费观看一级特黄欧美大片 | www.国产日本 | 毛片在线看看 | 日日欧美 | 天天拍夜夜爽 | 欧美日韩国产一区二区三区 | 欧美日韩在线一区二区三区 | 欧美毛片免费观看 | 99色在线视频| 99精品网| 亚洲免费在线 | 色综合色综合网色综合 | 亚洲精品久久区二区三区蜜桃臀 | 欧美精品久久久久久久久久 | 九九热精品视频在线观看 | 91在线中文字幕 | 国产精品一区二区在线 | 99视频| 精品国产乱码久久久久久闺蜜 | 国产精品美女久久久久久免费 | 91久色| 亚洲国产成人久久综合一区,久久久国产99 | 欧美xxxx性 | jizz在线免费观看 |