Advertisement

05.08.2008 at 01:44PM PDT, ID: 23387634
[x]
Attachment Details

How do I pass an array to a static generic function?

Asked by harpax in Java Programming Language

Tags: Java, 1.5

Hello,

I've a problem passing an int-array to a static generic function. The Compiler says 'The method sort(T[]) in the type Quick is not applicable for the arguments (int[])'. It worked fine when the sort function had an int[] parameter and the function itself has no error (according to eclipse)

Thanks in advanceStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
// from the calling class:
 
sort.Quick.sort(a);
 
// the class header
 
public class Quick extends Sort {
	public static <T extends Comparable> void sort(T[] a) {
		quicksort(a, 0, a.length - 1);  
	} 
	private static <T extends Comparable> void quicksort(T[] a, int lft, int rgt) {
.......
	}
}
[+][-]05.08.2008 at 01:46PM PDT, ID: 21528316

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.08.2008 at 01:48PM PDT, ID: 21528330

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Tags: Java, 1.5
Sign Up Now!
Solution Provided By: CEHJ
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.08.2008 at 02:13PM PDT, ID: 21528522

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628