Hello,
I have a Map where Coords is defined as so:
class Coords {
int x;
int y;
public boolean equals(Object o) {
Coords c = (Coords)o;
return c.x==x && c.y==y;
}
public Coords(int x, int y) {
super();
this.x = x;
this.y = y;
}
public int hashCode() {
return new Integer(x+"0"+y);
}
}
(not very good, I know, please don't tease me.) How can I now create a String where the characters are mapped from this map, for example:
Map<Coords, Character> map = new HashMap<Coords, Character>();
map.put(new Coords(0,0),'H');
map.put(new Coords(1,0),'e');
map.put(new Coords(2,0),'l');
map.put(new Coords(3,0),'l');
map.put(new Coords(4,0),'o');
map.put(new Coords(6,0),'!');
map put(new Coords(6,1),'!');
somehowTransformToString(map); //Hello !
// !
Thanks,
Isaac Waller
(note - it's not homework)