Yes, I understand that, but you are comparing the string that came from the form against the list of strings from the InstanceType enum, which was the original source of those strings in the list. There is no way that the value of 'type' can be anything other than one of the valid enumerators in the InstanceType enum. In order convert that string to an InstanceType enumerator, you can use InstanceType.valueOf(type).