/*
 * Copyright (C) 2010 TranceCode Software
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
 */
package org.trancecode.collection;

import com.google.common.base.Function;

import java.util.Map;
import java.util.Map.Entry;

/**
 * {@link Function} implementations related to {@link Map}.
 * 
 * @author Herve Quiroz
 */
public final class MapFunctions
{
    /**
     * @see Entry#getValue()
     */
    public static final <K, V> Function<Entry<K, V>, V> getValue()
    {
        @SuppressWarnings("unchecked")
        final GetValueFunction<K, V> function = (GetValueFunction<K, V>) GetValueFunction.INSTANCE;
        return function;
    }

    private static final class GetValueFunction<K, V> implements Function<Entry<K, V>, V>
    {
        private static final GetValueFunction<?, ?> INSTANCE = new GetValueFunction<Object, Object>();

        @Override
        public V apply(final Entry<K, V> entry)
        {
            return entry.getValue();
        }
    }

    private MapFunctions()
    {
        // No instantiation
    }
}

@@ -1039,16 +1039,617 @@
 tions%0A%7B%0A
+    /**%0A     * @see Entry#getKey()%0A     */%0A    public static final %3CK, V%3E Function%3CEntry%3CK, V%3E, K%3E getKey()%0A    %7B%0A        @SuppressWarnings(%22unchecked%22)%0A        final GetKeyFunction%3CK, V%3E function = (GetKeyFunction%3CK, V%3E) GetKeyFunction.INSTANCE;%0A        return function;%0A    %7D%0A%0A    private static final class GetKeyFunction%3CK, V%3E implements Function%3CEntry%3CK, V%3E, K%3E%0A    %7B%0A        private static final GetKeyFunction%3C?, ?%3E INSTANCE = new GetKeyFunction%3CObject, Object%3E();%0A%0A        @Override%0A        public K apply(final Entry%3CK, V%3E entry)%0A        %7B%0A            return entry.getKey();%0A        %7D%0A    %7D%0A%0A
     /**%0A

Add MapFunctions.getKey()