Question: Help with Solving these with explanations and the ones that cannot be solved suggest the process I should follow, thanks ------------------------------------------------------------------------------ 1.) public boolean contains(Object
Help with Solving these with explanations and the ones that cannot be solved suggest the process I should follow, thanks
------------------------------------------------------------------------------
1.)
public boolean contains(Object o) { if (o instanceof HexTile) { HexTile h = (HexTile)o; //TODO check if there is an entry in contents equal to h } return false; }
2.)
public boolean remove(Object o) { if (o instanceof HexTile) { HexTile h = (HexTile)o; if (contents.get(h.getLocation()) == h.getTerrain()) { //TODO remove the hex tile return true; } } return false; }
3.)
public HexTile next() { Map.Entry e = base.next(); return null; // TODO: generate hex tile on demand based on entry //look at the getValue and getKey methods for Entry }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
