001/* 
002 * Copyright (C) 2016 Hobrasoft s.r.o.
003 *
004 * This program is free software: you can redistribute it and/or modify
005 * it under the terms of the GNU Affero General Public License as published by
006 * the Free Software Foundation, either version 3 of the License, or
007 * (at your option) any later version.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU Affero General Public License for more details.
013 *
014 * You should have received a copy of the GNU Affero General Public License
015 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
016 */
017package cz.hobrasoft.pdfmu;
018
019import java.util.Map;
020import java.util.SortedMap;
021
022/**
023 * Sorts a map by its keys.
024 *
025 * @param <K> the type of keys of the maps to be sorted
026 *
027 * @author <a href="mailto:filip.bartek@hobrasoft.cz">Filip Bartek</a>
028 */
029public interface MapSorter<K> {
030
031    /**
032     * Sorts a map by its keys.
033     *
034     * @param <V> the type of values
035     * @param unsorted the map to be sorted
036     * @return `unsorted` with elements sorted by the keys
037     */
038    public <V> SortedMap<K, V> sort(Map<K, V> unsorted);
039}