Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2007

Tip: Looking for answers? Try searching our database.

problem in overwrite using Generics

Thread view: 
SantaJava@gmail.com - 30 Jan 2007 04:23 GMT
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
Daniel Pitts - 30 Jan 2007 05:42 GMT
On Jan 29, 8:23 pm, "SantaJ...@gmail.com" <SantaJ...@gmail.com> wrote:
> package jp.co.nec.rfidmgr.epcis;
>
[quoted text clipped - 22 lines]
>
> 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) {
   }
}


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.