I have a Java enum that represents potential values for a given field, along with a unique identifier used to identify that value:

```
    public enum MyEnum {
       TYPEA("A"),
       TYPEB("B")

       private String code;

       private MyEnum(String code){
          this.code = code;
       }

       public String getCode(){
          return code;
       }
   }

```

Id like to add a custom comparator:

```
public boolean equals(String code){
    return getCode().equals(code);
}

```

This will allow me to compare my enums with strings.

Is there any pitfall that im missing? I cant see anything obviously wrong...