This prints false
List vowelsList=Arrays.asList(new char[]{'a','e','i','o','u'});
System.out.println(vowelsList.contains('a'));//false
This prints true
List vowelsList=Arrays.asList(new Character[]{'a','e','i','o','u'});
System.out.println(vowelsList.contains('a'));//true
char
is autoboxed to Character
which I had used in char array initailizer..Why am I getting different results!
char[]
is considered as a single parameter in theT ... params
, whileCharacter[]
parameter is considered the array parameter forT ... params
. – Contagious