From: <tho...@us...> - 2013-11-20 14:27:24
|
Revision: 7573 http://bigdata.svn.sourceforge.net/bigdata/?rev=7573&view=rev Author: thompsonbry Date: 2013-11-20 14:27:18 +0000 (Wed, 20 Nov 2013) Log Message: ----------- Formatting, final, arg check should throw exception rather than assert. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/NV.java Modified: branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/NV.java =================================================================== --- branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/NV.java 2013-11-20 14:23:34 UTC (rev 7572) +++ branches/BIGDATA_RELEASE_1_3_0/bigdata/src/java/com/bigdata/bop/NV.java 2013-11-20 14:27:18 UTC (rev 7573) @@ -167,19 +167,29 @@ * Wrap name/value pairs as a map. * * @param nameValuePairs - * Pairs each being a string followed by an object, being the name value pair in the resulting map. - * + * Pairs each being a string followed by an object, being the + * name value pair in the resulting map. + * * @return The map. */ - static public Map<String,Object> asMap(Object ... nameValuePairs) { - assert nameValuePairs.length % 2 == 0; - final Map<String,Object> rslt = new LinkedHashMap<String,Object>(nameValuePairs.length/2); - for (int i=0;i<nameValuePairs.length;i+=2) { - rslt.put((String)nameValuePairs[i], nameValuePairs[i+1]); - } - return rslt; - } + static public Map<String, Object> asMap(final Object... nameValuePairs) { + if (nameValuePairs.length % 2 != 0) + throw new IllegalArgumentException(); + + final Map<String, Object> rslt = new LinkedHashMap<String, Object>( + nameValuePairs.length / 2); + + for (int i = 0; i < nameValuePairs.length; i += 2) { + + rslt.put((String) nameValuePairs[i], nameValuePairs[i + 1]); + + } + + return rslt; + + } + /** * Wrap an array name/value pairs as a {@link Map}. * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |