久久久久久久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屋-程序員
主站蜘蛛池模板: 亚洲一区二区免费视频 | 在线播放中文字幕 | 日本免费一级片 | 日韩精品毛片 | 日韩一级淫片 | 久久精品欧美一区二区 | 国产精品久久久久久中文字 | 一级毛片免费 | 亚洲激情在线视频 | 亚洲日本视频 | 黄色免费观看视频 | 国产精品偷乱一区二区三区 | 日韩欧美精品一区二区 | 97人人插 | 日韩av免费看 | 99久久综合 | av三级在线观看 | 欧美成人免费在线视频 | 亚洲一区在线看 | 97国产在线视频 | 亚洲激情第一页 | 福利小视频 | 成人小视频在线 | www.久久久久久 | 玖玖视频| 免费黄色一级视频 | 一区二区三区影院 | 欧美激情一区二区 | 免费视频一区二区 | 久久精品毛片 | 国产草草影院 | 特大黑人巨交吊性xxxx视频 | 日韩一区二区免费视频 | 日日干日日操 | 极品白嫩少妇无套内谢 | 国产午夜三级一区二区三 | 婷久久| 日本欧美视频 | 国产这里只有精品 | 日韩午夜精品 | 国产精品一区二区视频 |