Java List Create createSourceExtensionList(Map sourceExtensionMap)

Here you can find the source of createSourceExtensionList(Map sourceExtensionMap)

Description

Transforms the map of source extensions into a list of source extension sorted by the source class name of the source extension.

License

Open Source License

Parameter

Parameter Description
E Extension type.
sourceExtensionMap Map of source extensions.

Return

List of source extensions.

Declaration

public static <E> List<E> createSourceExtensionList(Map<String, E> sourceExtensionMap) 

Method Source Code

//package com.java2s;
/*//from www .  j a  v a  2s  . com
 * OfficeFloor - http://www.officefloor.net
 * Copyright (C) 2005-2013 Daniel Sagenschneider
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.ArrayList;
import java.util.Collections;

import java.util.List;
import java.util.Map;

public class Main {
    /**
     * Transforms the map of source extensions into a list of source extension
     * sorted by the source class name of the source extension.
     * 
     * @param <E>
     *            Extension type.
     * @param sourceExtensionMap
     *            Map of source extensions.
     * @return List of source extensions.
     */
    public static <E> List<E> createSourceExtensionList(Map<String, E> sourceExtensionMap) {

        // Obtain the sorted source class names
        List<String> sourceClassNames = new ArrayList<String>(sourceExtensionMap.keySet());
        Collections.sort(sourceClassNames);

        // Create the listing of source extensions
        List<E> list = new ArrayList<E>(sourceClassNames.size());
        for (String sourceClassName : sourceClassNames) {
            E sourceExtension = sourceExtensionMap.get(sourceClassName);
            list.add(sourceExtension);
        }

        // Return the source extension list
        return list;
    }
}

Related

  1. createQueryString(String query, List params)
  2. createRegion(String string, List regionList, int startIndex, int endIndex)
  3. createReleasesString(List tagsList)
  4. createResponse(String inputLabel, List imageLabels)
  5. createSingletonList(T element)
  6. createSpaceDelimitedString(List stringList)
  7. createStringDummyList()
  8. createStringFromIntArray( List listOfNumbers)
  9. createStringFromIntegerList(List lst)