Created
February 7, 2019 20:09
-
-
Save jerolba/7931570978ab9ff1228fd04737b688a3 to your computer and use it in GitHub Desktop.
Composed key object sample
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
Map<MyObjectKey, MyObject> map = new HashMap<>(); | |
//Or loaded from database: | |
MyObject obj1 = new MyObject(1311, 313, "Madrid"); | |
MyObject obj2 = new MyObject(1332, 313, "Barcelona"); | |
MyObject obj3 = new MyObject(1311, 928, "Zaragoza"); | |
.... | |
.... | |
map.put(obj1.getKey(), obj1); | |
map.put(obj2.getKey(), obj2); | |
map.put(obj3.getKey(), obj3); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment