I have a class Player which I load from a database:
public class Player{
int id, score;
String name;
public Player(int id, String name, int score) {
this.id = id;
this.name = name;
this.score = score
}
public int getID() {
return id;
}
public String getName() {
return name;
}
public String getScore() {
return score;
}
}
The class Main has all of them in an ArrayList<Player> player.
Is it possible to find a particular instance of that class with something similar to the where clause in SQL?
I just need the name if I have the ID.
Example:
"SELECT name FROM Player WHERE id = 5";
No, but you can keep your
Playersin aHashMap:and then get the required
Playerwith: