public static HoroscopeSign getHoroscopeSign(String sign) { for (HoroscopeSign hSign : HoroscopeSign.values()) { if (hSign.getSign().equalsIgnoreCase(sign)) { return hSign; } } // default return return HoroscopeSign.NO_ANSWER; }
public static HoroscopeSign[] toHoroscopeSignArray(String[] signCodes) { if (signCodes == null || signCodes.length == 0) { return new HoroscopeSign[0]; } // if not null and not empty int length = signCodes.length; HoroscopeSign[] result = new HoroscopeSign[length]; for (int idx = 0; idx < length; idx++) { result[idx] = HoroscopeSign.getHoroscopeSign(signCodes[idx]); } return result; }