@Test public void testPut() { MajorIssueConfig majorConfig = new MajorIssueConfig("major", ImmutableList.of()); MinorIssueConfig minor1Config = new MinorIssueConfig("minor1", 100, "www.cnn.com"); majorConfig = majorConfig.put(minor1Config); assertThat(majorConfig, equalTo(new MajorIssueConfig("major", ImmutableList.of(minor1Config)))); MinorIssueConfig minor2Config = new MinorIssueConfig("minor2", 9, "www"); majorConfig = majorConfig.put(minor2Config); assertThat( majorConfig, equalTo(new MajorIssueConfig("major", ImmutableList.of(minor1Config, minor2Config)))); MinorIssueConfig minor1ConfigAgain = new MinorIssueConfig("minor1", 90, "www"); majorConfig = majorConfig.put(minor1ConfigAgain); assertThat( majorConfig, equalTo(new MajorIssueConfig("major", ImmutableList.of(minor2Config, minor1ConfigAgain)))); }
public MajorIssueConfig put(MinorIssueConfig minorIssueConfig) { Map<String, MinorIssueConfig> newMap = new HashMap<>(_minorIssueConfigs); newMap.put(minorIssueConfig.getMinor(), minorIssueConfig); return new MajorIssueConfig(_majorIssue, newMap); }
MajorIssueConfig { public MajorIssueConfig put(MinorIssueConfig minorIssueConfig) { Map<String, MinorIssueConfig> newMap = new HashMap<>(_minorIssueConfigs); newMap.put(minorIssueConfig.getMinor(), minorIssueConfig); return new MajorIssueConfig(_majorIssue, newMap); } }
MajorIssueConfig { public MajorIssueConfig put(MinorIssueConfig minorIssueConfig) { Map<String, MinorIssueConfig> newMap = new HashMap<>(_minorIssueConfigs); newMap.put(minorIssueConfig.getMinor(), minorIssueConfig); return new MajorIssueConfig(_majorIssue, newMap); } MajorIssueConfig(String majorIssue, List<MinorIssueConfig> minorIssueConfigs);  MajorIssueConfig(String majorIssue, Map<String, MinorIssueConfig> minorIssueConfigs); }
MajorIssueConfig { public MajorIssueConfig put(MinorIssueConfig minorIssueConfig) { Map<String, MinorIssueConfig> newMap = new HashMap<>(_minorIssueConfigs); newMap.put(minorIssueConfig.getMinor(), minorIssueConfig); return new MajorIssueConfig(_majorIssue, newMap); } MajorIssueConfig(String majorIssue, List<MinorIssueConfig> minorIssueConfigs);  MajorIssueConfig(String majorIssue, Map<String, MinorIssueConfig> minorIssueConfigs); @Override boolean equals(Object o); MajorIssueConfig delMinorIssueConfig(String minorIssue); @JsonProperty(PROP_MAJOR_ISSUE) @Nonnull String getMajorIssue(); Optional<MinorIssueConfig> getMinorIssueConfig(String minorIssue); @JsonIgnore @Nonnull Map<String, MinorIssueConfig> getMinorIssueConfigsMap(); @JsonProperty(PROP_MINOR_ISSUE_CONFIGS) List<MinorIssueConfig> getMinorIssueConfigs(); @Override int hashCode(); MajorIssueConfig put(MinorIssueConfig minorIssueConfig); @Override String toString(); }
MajorIssueConfig { public MajorIssueConfig put(MinorIssueConfig minorIssueConfig) { Map<String, MinorIssueConfig> newMap = new HashMap<>(_minorIssueConfigs); newMap.put(minorIssueConfig.getMinor(), minorIssueConfig); return new MajorIssueConfig(_majorIssue, newMap); } MajorIssueConfig(String majorIssue, List<MinorIssueConfig> minorIssueConfigs);  MajorIssueConfig(String majorIssue, Map<String, MinorIssueConfig> minorIssueConfigs); @Override boolean equals(Object o); MajorIssueConfig delMinorIssueConfig(String minorIssue); @JsonProperty(PROP_MAJOR_ISSUE) @Nonnull String getMajorIssue(); Optional<MinorIssueConfig> getMinorIssueConfig(String minorIssue); @JsonIgnore @Nonnull Map<String, MinorIssueConfig> getMinorIssueConfigsMap(); @JsonProperty(PROP_MINOR_ISSUE_CONFIGS) List<MinorIssueConfig> getMinorIssueConfigs(); @Override int hashCode(); MajorIssueConfig put(MinorIssueConfig minorIssueConfig); @Override String toString();  }