ハッシュマップのlastEntryのキーに別の文字列を入れたい。
lastEntry の値を確認して変更した後、setKey または別の関数を使用して lastEntry を変更したいキーを変更できませんでした。
EditText name; // put that as the key
Map<String,Integer> Names = new HashMap<String,Integer>(10);
// .
// .
// .
name = (EditText) findViewById(R.id.namep);
lastEntry の値を確認して変更する私の関数:
boolean flagScore = false;
Entry<String, Integer> lastEntry = Names.lastEntry();
if(lastEntry.getValue() < score){
lastEntry.setValue(score);
flagScore = true;
}
if(flagScore){
// put name.getText().toString as key
}