<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Primitive Array to Object[]</title>
	<atom:link href="http://www.codesmell.org/blog/2010/01/primitive-array-to-object/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codesmell.org/blog/2010/01/primitive-array-to-object/</link>
	<description>another useless blog, virtually noone is going to read....</description>
	<lastBuildDate>Tue, 03 Aug 2010 00:43:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Uwe Schaefer</title>
		<link>http://www.codesmell.org/blog/2010/01/primitive-array-to-object/comment-page-1/#comment-110</link>
		<dc:creator>Uwe Schaefer</dc:creator>
		<pubDate>Thu, 28 Jan 2010 17:46:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.codesmell.org/blog/?p=3205#comment-110</guid>
		<description>sure, but then it´d be public static &lt; T &gt; T[] convertPrimitiveArray(final Object array, Class&lt; T &gt; wrapperClass) 
but it throws RTEs at you anyway :)</description>
		<content:encoded><![CDATA[<p>sure, but then it´d be public static < T > T[] convertPrimitiveArray(final Object array, Class< T > wrapperClass)<br />
but it throws RTEs at you anyway <img src='http://www.codesmell.org/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: B</title>
		<link>http://www.codesmell.org/blog/2010/01/primitive-array-to-object/comment-page-1/#comment-109</link>
		<dc:creator>B</dc:creator>
		<pubDate>Thu, 28 Jan 2010 14:39:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.codesmell.org/blog/?p=3205#comment-109</guid>
		<description>You can generify the method to have the wrapper return type (at the cost of unchecked cast).

&lt;code&gt;
    public static  T[] convertPrimitiveArray(final Object array, Class wrapperClass) {
        final int arrayLength = Array.getLength(array);
        final T[] result = (T[]) Array.newInstance(wrapperClass, arrayLength);
        for (int i = 0; i &lt; arrayLength; i++) {
            Array.set(result, i, Array.get(array, i));
        }
        return result;
    }
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>You can generify the method to have the wrapper return type (at the cost of unchecked cast).</p>
<p><code><br />
    public static  T[] convertPrimitiveArray(final Object array, Class wrapperClass) {<br />
        final int arrayLength = Array.getLength(array);<br />
        final T[] result = (T[]) Array.newInstance(wrapperClass, arrayLength);<br />
        for (int i = 0; i &lt; arrayLength; i++) {<br />
            Array.set(result, i, Array.get(array, i));<br />
        }<br />
        return result;<br />
    }<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
