Skip to content

Instantly share code, notes, and snippets.

@jerolba
Created February 7, 2019 20:09
Show Gist options
  • Save jerolba/7931570978ab9ff1228fd04737b688a3 to your computer and use it in GitHub Desktop.
Save jerolba/7931570978ab9ff1228fd04737b688a3 to your computer and use it in GitHub Desktop.
Composed key object sample
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