How to create a hardcoded lookup that would be reused by different parts of the program?
<p>I have what seems to me a basic issue that confuses me.</p>

<p>Right now I have the following bad design (it seems to me it is bad design). I have a util class which looks something like this:</p>

<pre><code>public class Countries 
{
    public boolean isCountryPresent ( String c )
    {
        //public static final http://en.wikipedia.org/wiki/ISO_3166-1 
        Set&lt;String&gt; myStrings = new HashSet&lt;String&gt;();
        myStrings.add("us"); // Afghanistan
        myStrings.add("af"); // Afghanistan
        myStrings.add("dz"); // Algeria
        myStrings.add("ao"); // Angola
        myStrings.add("az"); // Azerbiajan
        ...


    if ( myStrings.contains(c))
        return true;
    else
        return false;
}
</code></pre>

<p>And then I check for the existance of the item like this:</p>

<pre><code>Countries co = new Countries ( );
boolean isPresent = co.isCountryPresent( countryISOCode );
</code></pre>

<p>But I am thinking that instantiating the object each time wastes resources, no? Is there a more efficient way for doing this given that the country data does not need to be compiled more than once and does not change?</p>
