Here you can find the source of createMap(Object... args)
Parameter | Description |
---|---|
args | map entries, pass key/value pairs |
private static Map<Object, Object> createMap(Object... args)
//package com.java2s; /*/*from w w w . j a v a 2 s . co m*/ * RED5 Open Source Flash Server - http://www.osflash.org/red5 * * Copyright (c) 2006-2007 by respective authors (see below). All rights reserved. * * 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 */ import java.util.HashMap; import java.util.Map; public class Main { /** * Helper function to create maps easier. * * @param args map entries, pass key/value pairs * @return map */ private static Map<Object, Object> createMap(Object... args) { assert args.length % 2 == 0; Map<Object, Object> result = new HashMap<Object, Object>(); for (int i = 0; i < args.length; i += 2) { result.put(args[i], args[i + 1]); } return result; } }