久久久久久久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屋-程序員
主站蜘蛛池模板: 亚洲一二三在线 | 日韩精品成人 | 精品久久久久一区二区国产 | 欧美色性 | 日韩中文在线观看 | 欧美在线播放一区 | 在线观看www视频 | 国产一区二区三区在线 | 日韩成人免费中文字幕 | 久久久性色精品国产免费观看 | 久久99精品久久久久久琪琪 | 欧美色综合一区二区三区 | caoporn地址 | 国产精品揄拍一区二区 | 亚洲精品久久久蜜桃网站 | 中文在线日韩 | 国产在线视频一区二区董小宛性色 | 亚洲精品电影在线观看 | 国产三级一区二区 | 成人午夜精品 | 国产精品a久久久久 | 97精品一区二区 | 午夜99| 国产精品视频导航 | 成人小视频在线观看 | 免费看的黄网站 | 日韩网| 久久久久久国产精品 | 国产精品综合网 | 久久av网站 | 亚洲综合二区 | 欧美一级一区 | 精品国偷自产在线 | 国产日产精品一区二区三区四区 | 中文字幕在线一区 | 国产一区二区精品在线观看 | 亚洲国产偷 | 97视频在线观看免费 | 色婷婷综合久久久中字幕精品久久 | 欧美国产一区二区三区 | 日韩精品一区二区三区第95 |