Last active
December 21, 2019 14:42
-
-
Save recepinanc/8cdb8f88161f4adb7ef91210b2ceeab4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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