Skip to content

Instantly share code, notes, and snippets.

@isaacssemugenyi
Created January 5, 2024 13:08
Show Gist options
  • Save isaacssemugenyi/e033721049ba69aa8db50ae31103502e to your computer and use it in GitHub Desktop.
Save isaacssemugenyi/e033721049ba69aa8db50ae31103502e to your computer and use it in GitHub Desktop.
// remove the countriesPresent method in the inner Builder class and replace it with the method below
public Builder addCountry(String countriesPresent){
this.countriesPresent.add(countriesPresent);
return this;
}
// Inside of .countriesPresent(List.of("Mexico", "Brazil")) with .addCountry("Kenya").addCountry("Uganda") in the Main.java
Car car3 = new Car.Builder()
.make("Ford")
.name("Mastunga")
.color("Red")
.model(2023)
.addCountry("Kenya")
.addCountry("Uganda")
.build();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment