<?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: Java varargs: inconsistent behaviour if you pass an array</title>
	<atom:link href="http://www.databasesandlife.com/java-varargs-inconsistent-behaviour-if-you-pass-an-array/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.databasesandlife.com/java-varargs-inconsistent-behaviour-if-you-pass-an-array/</link>
	<description>Adrian Smith's blog</description>
	<lastBuildDate>Mon, 06 Feb 2012 05:20:25 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Hamdi</title>
		<link>http://www.databasesandlife.com/java-varargs-inconsistent-behaviour-if-you-pass-an-array/comment-page-1/#comment-46238</link>
		<dc:creator>Hamdi</dc:creator>
		<pubDate>Fri, 22 Apr 2011 14:14:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=461#comment-46238</guid>
		<description>I don&#039;t think that this is an inconsistent behaviour. This is associated with overloading. The rule is &quot;overloaded varagrs methods are always choosen last.&quot;. We can think of the parametrized method Arrays.asList(T...) as the existence (for the first example) of these overloaded methods :
Arrays.asList(String[]) ( or Arrays.asList(String...) for T = String)
Arrays.asList(String[]...) (for T = String[])
This is why, in the first case, Arrays.asList(String[]) is choosen and the return type is the String List.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think that this is an inconsistent behaviour. This is associated with overloading. The rule is &#8220;overloaded varagrs methods are always choosen last.&#8221;. We can think of the parametrized method Arrays.asList(T&#8230;) as the existence (for the first example) of these overloaded methods :<br />
Arrays.asList(String[]) ( or Arrays.asList(String&#8230;) for T = String)<br />
Arrays.asList(String[]&#8230;) (for T = String[])<br />
This is why, in the first case, Arrays.asList(String[]) is choosen and the return type is the String List.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robin Salih</title>
		<link>http://www.databasesandlife.com/java-varargs-inconsistent-behaviour-if-you-pass-an-array/comment-page-1/#comment-11396</link>
		<dc:creator>Robin Salih</dc:creator>
		<pubDate>Thu, 15 Apr 2010 10:53:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.databasesandlife.com/?p=461#comment-11396</guid>
		<description>It is a similar story in C#.  Consider the following code:
&lt;code&gt;
namespace&#160;ConsoleApplication1
{
&#160;&#160;&#160;&#160;class&#160;Program
&#160;&#160;&#160;&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;static&#160;void&#160;Main(string[]&#160;args)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;object[]&#160;array&#160;=&#160;{&#160;5,&#160;&quot;five&quot;&#160;};
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Fn(array);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Fn(array,&#160;6,&#160;&quot;six&quot;);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;static&#160;void&#160;Fn(params&#160;object[]&#160;p)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;{
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;foreach&#160;(var&#160;a&#160;in&#160;p)
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Console.WriteLine(a);
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;}
&#160;&#160;&#160;&#160;}
}
&lt;/code&gt;
The first call passes in the array created in Main, the second call, passes in an array with 3 elements, the array created in Main, followed by 6 and &quot;six&quot;.  So a bit inconsistent.</description>
		<content:encoded><![CDATA[<p>It is a similar story in C#.  Consider the following code:<br />
<code><br />
namespace&nbsp;ConsoleApplication1<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;class&nbsp;Program<br />
&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;void&nbsp;Main(string[]&nbsp;args)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object[]&nbsp;array&nbsp;=&nbsp;{&nbsp;5,&nbsp;"five"&nbsp;};<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fn(array);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fn(array,&nbsp;6,&nbsp;"six");<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;static&nbsp;void&nbsp;Fn(params&nbsp;object[]&nbsp;p)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(var&nbsp;a&nbsp;in&nbsp;p)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Console.WriteLine(a);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
}<br />
</code><br />
The first call passes in the array created in Main, the second call, passes in an array with 3 elements, the array created in Main, followed by 6 and &#8220;six&#8221;.  So a bit inconsistent.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

