Generics: how to read actual type parameters
- From: marek.dudek@xxxxxxxxx
- Date: Sun, 30 Sep 2007 12:50:54 -0700
For example:
public class Pair<S> {
public Pair(S first, S second) {
this.first = first;
this.second = second;
}
public String toString() {
Class clas = ??? ;
return "Pair of " + clas.toString();
}
public S first;
public S second;
}
so that after instantiating
Pair<Double> p = new Pair<Double>( 0.0, 0.0 );
p.toString() gives "Pair of Double"
TIA
.
- Follow-Ups:
- Re: Generics: how to read actual type parameters
- From: Joshua Cranmer
- Re: Generics: how to read actual type parameters
- Prev by Date: Re: OT: Unicode and vi(m). Was Re: Great SWT Program
- Next by Date: Re: Generics: how to read actual type parameters
- Previous by thread: Re: ONLINE CODING EVENT AT INNOVISION@NSIT
- Next by thread: Re: Generics: how to read actual type parameters
- Index(es):