I use the code in this link link
This is the code that i used on my project
public static Map<Coordinate, Field> copy(Map<Coordinate, Field> original) {
Map<Coordinate, Field> copy = new HashMap<>();
for (Map.Entry<Coordinate, Field> entry : original.entrySet()) {
copy.put(entry.getKey(), entry.getValue());
}
return copy;
}
but it did not work so I used the other one
Map<Coordinate, Field> temp = board.entrySet().stream()
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
but it still did not work, so I want to ask if there is other way to copy a Map<Obeject, Object>? or did I do something wrong?