Skip to content

Instantly share code, notes, and snippets.

@recepinanc
Last active December 21, 2019 14:42
Show Gist options
  • Save recepinanc/8cdb8f88161f4adb7ef91210b2ceeab4 to your computer and use it in GitHub Desktop.
Save recepinanc/8cdb8f88161f4adb7ef91210b2ceeab4 to your computer and use it in GitHub Desktop.
import java.util.HashMap;
import java.util.HashSet;
public class Main {
public static void main(String[] args) {
Game ageOfEmpires = new Game("Age of Empires 2");
HashMap<String, Game> gamesMap = new HashMap<>();
gamesMap.put(ageOfEmpires.getName(), ageOfEmpires);
gamesMap.get("Age of Empires 2");
HashSet<Game> gamesSet = new HashSet<>();
gamesSet.add(ageOfEmpires);
}
}
class Game {
private String name;
public Game(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment