How to specify an undetermined Object (Generic) as parameter in method() ?

Discussion in 'Java' started by Gianni Galore, Jan 18, 2011.

  1. Assume I have a method similar to

    public Set <AAA> myMethod ( ...???..., Set <BBB> inparm2) {
    ...
    }

    What do I have to fill in "???" to be able to pass various different objects.
    In other words afterwards calls like the following should be valid:

    CCCType c = new CCCType();
    DDDType d = new DDDType();
    .....

    .... = myMethod(c, ....);

    or

    .... = myMethod(d, ...);

    Is there something like:

    public Set <AAA> myMethod ( Object<> inparm1, Set <BBB> inparm2) {
    ...
    }



    Gianni
     
    Gianni Galore, Jan 18, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon
    Replies:
    1
    Views:
    409
    Teemu Keiski
    May 17, 2004
  2. BdS
    Replies:
    0
    Views:
    382
  3. Alan
    Replies:
    5
    Views:
    305
  4. Luca D.

    How to specify a parameter

    Luca D., Mar 15, 2008, in forum: Java
    Replies:
    13
    Views:
    537
    Mark Space
    Mar 19, 2008
  5. Chuck Insight

    Please Tell Me How to specify the parameter.

    Chuck Insight, Mar 20, 2005, in forum: ASP .Net Web Controls
    Replies:
    6
    Views:
    181
    Chuck Insight
    Mar 22, 2005
Loading...

Share This Page