Java tutorial
/******************************************************************************* * Educational Online Test Delivery System * Copyright (c) 2013 American Institutes for Research * * Distributed under the AIR Open Source License, Version 1.0 * See accompanying file AIR-License-1_0.txt or at * http://www.smarterapp.org/documents/American_Institutes_for_Research_Open_Source_Software_License.pdf ******************************************************************************/ package org.opentestsystem.authoring.testspecbank.domain; import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @SuppressWarnings("rawtypes") public final class EnumNamesAsString { public static <T extends Enum> String[] NAME_VALUES_AS_STRING(final T[] enumValues) { return Iterables.toArray(Iterables.transform(Lists.newArrayList(enumValues), new Function<T, String>() { @Override public String apply(final T enumIn) { if (enumIn != null) { return enumIn.name(); } return ""; } }), String.class); } }