samedi 21 octobre 2023

How I do a nice design of a hardcoded list in Java? [closed]

In java I have a list of object in code, I need to know what is a nice design to do that, eg: I had an ideia like a config file in this all companies in json format, but i don't if it is really worth.

public List<Company> getAllCompany() {
 
 List companies = new ArrayList<>();
 
 companies.add("Facebook","Silicon Valley","www.facebook.com");
 companies.add("Google","Silicon Valley","www.google.com");
 companies.add("Intel","Silicon Valley","www.intel.com");
 companies.add("Nvidia","Silicon Valley","www.nvidia.com");

 return companies;

}

I need to improve my design, wanna just know the possibilities and how other people think about it.

Aucun commentaire:

Enregistrer un commentaire