Any simple Java way to pass parts of a hashmap to another hashmap?
- by Arvanem
Hi folks,
For my trading program, a Merchant object has a qualities HashMap of enumerated Qualities with Boolean values.
public class Merchants {
private Map<Qualities, Boolean> qualities = new HashMap<Qualities, Boolean>();
I would like to give each Merchant object a further ratedQualities HashMap of True Qualities with Byte or Integer values representing the Rating of those Qualities.
For example, a given Merchant could have a "1" Rating associated with their True Stockbroking Quality.
The problem is Java does not let me do this easily. The following code demonstrates my intentions but doesn't compile:
private Map<qualities-TRUE, Byte> ratedQualities = new HashMap<qualities-TRUE, Byte>();
According to this link text one solution is to create a Wrapper for the qualities HashMap. Is this the only solution or is there a better way?
Thanks in advance for your help.