Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > problem in overwrite using Generics

Reply
Thread Tools

problem in overwrite using Generics

 
 
SantaJava@gmail.com
Guest
Posts: n/a
 
      01-30-2007
package jp.co.nec.rfidmgr.epcis;

import java.util.List;
import java.util.Map;

public class T {
public void temp(List<String> str) {

}

public void temp(List<Integer> str) {

}

public void temp(List<Map<Integer,String>> str) {

}
}

error:
Duplicate method temp(List<String>) in type T T.java
Duplicate method temp(List<Integer>) in type T T.java
Duplicate method temp(List<Map<Integer,String>>) in type T T.java

how can i overwrite a method using generics

 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      01-30-2007
On Jan 29, 8:23 pm, "(E-Mail Removed)" <(E-Mail Removed)> wrote:
> package jp.co.nec.rfidmgr.epcis;
>
> import java.util.List;
> import java.util.Map;
>
> public class T {
> public void temp(List<String> str) {
>
> }
>
> public void temp(List<Integer> str) {
>
> }
>
> public void temp(List<Map<Integer,String>> str) {
>
> }
>
> }
>
> error:
> Duplicate method temp(List<String>) in type T T.java
> Duplicate method temp(List<Integer>) in type T T.java
> Duplicate method temp(List<Map<Integer,String>>) in type T T.java
>
> how can i overwrite a method using generics

The problem is, you can't.
Unles you name temp something else, and in this case, there really
isn't any reason not to.

import java.util.List;
import java.util.Map;

public class T {

public void tempString(List<String> str) {
}

public void tempInteger(List<Integer> str) {
}

public void tempMap(List<Map<String, Integer>> str) {
}
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
USB key overwrite - using DD ? BertieBigBollox@gmail.com Computer Support 3 09-14-2009 09:02 PM
generics depending on generics Soul VHDL 0 02-02-2009 09:14 AM
problem in overwrite using Generics SantaJava@gmail.com Java 0 01-30-2007 04:23 AM
Can't convert a generics list of objects into a generics list ofinterfaces Juergen Berchtel Java 1 05-20-2005 02:07 PM



Advertisments