001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018 package org.apache.geronimo.console.util;
019
020 import java.util.Hashtable;
021 import java.util.Iterator;
022 import java.util.Map;
023
024 /**
025 * @author dimperial
026 *
027 * TODO To change the template for this generated type comment go to Window -
028 * Preferences - Java - Code Style - Code Templates
029 */
030 public abstract class CollectionHelper {
031
032 public static Hashtable parameterMapToHashtable(Map m) {
033 Hashtable ret = new Hashtable();
034 ret.putAll(m);
035 for (Iterator i = ret.keySet().iterator(); i.hasNext();) {
036 Object key = i.next();
037 String[] value = (String[]) ret.get(key);
038 try {
039 ret.put(key, value[0]);
040 } catch (ArrayIndexOutOfBoundsException e) {
041 // This should not happen but if it does just continue
042 // processing.
043 }
044 }
045 return ret;
046 }
047
048 }