One-of-a-kind objects
<p>I want to create a one-of-a-kind object for certain properties:</p>

<pre><code>import java.util.HashMap;

public class SourceLanguage {
    private  final String name;
    private static HashMap&lt;String,SourceLanguage&gt; existing;

    private SourceLanguage(String name){
        this.name = name;
    }

    public String getName(){
        return name;
    }

    public static SourceLanguage get(String name){
        if(existing==null){
            existing = new HashMap&lt;&gt;();
            SourceLanguage sl = new SourceLanguage(name);
            existing.put(name.toLowerCase(),sl);
            return sl;
        }
        SourceLanguage check = existing.get(name);
        if(check==null){
            SourceLanguage sl = new SourceLanguage(name);
            existing.put(name.toLowerCase(),sl);
            return sl;
        }else {
            return check;
        }
    }
}
</code></pre>

<p>I want to use objects of this class as keys in another map.</p>

<p>I feel it's a bit of an overkill.
Is there an easier way to achieve the goal?</p>
