Here you can find the source of findEnumIgnoreCase(Class
public static <T extends Enum<T>> T findEnumIgnoreCase(Class<T> enumClass, String string, T defValue)
//package com.java2s; /******************************************************************************* * Copyright ? 2012-2015 eBay Software Foundation * This program is dual licensed under the MIT and Apache 2.0 licenses. * Please see LICENSE for more information. *******************************************************************************/ import java.util.EnumSet; public class Main { public static <T extends Enum<T>> T findEnumIgnoreCase(Class<T> enumClass, String string, T defValue) { for (T value : EnumSet.allOf(enumClass)) if (value.toString().equalsIgnoreCase(string)) return value; return defValue; }//from w ww . j a va 2 s . c o m }