I'm french beginner in Java and Android developpement. Actually I try to make an exercice but i'm stuck...
I have an ArrayList (playersList2) of Object (Players), Players contains string (mFirstName) and int (mScore))
I made some try with collection, loop, and I read lot of documentation and forum but i don'f find a solution however I'm pretty sure it's easy
Players players = new Players(mFirstname, mScore);
mPreferences = getSharedPreferences(PREF_PLAYERS_LIST, MODE_PRIVATE);
String fromJsonPlayersList = mPreferences.getString(PREF_PLAYERS_LIST, null);
Gson gson = new Gson();
ArrayList<Players> playersList2 = gson.fromJson(fromJsonPlayersList, new TypeToken<ArrayList<Players>>()
{
}.getType());
/* find the weakiest players/
if //mscore is bigger than weakest players
{//remove the weakest players and add this one
}*/
I want to find the minimum mScore in the entire ArrayList to make a condition(if current mScore > minimal playersList2 replace weakiest PlayersList2 Players by current Players)
Thanks a lot