Here you can find the source of createSourceExtensionList(Map
Parameter | Description |
---|---|
E | Extension type. |
sourceExtensionMap | Map of source extensions. |
public static <E> List<E> createSourceExtensionList(Map<String, E> sourceExtensionMap)
//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; } }