Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.List;
- import java.util.Iterator;
- // proof that A and B are the same type
- public class Equal<A,B> {
- public <A> Equal<A,A> refl(){ return new Equal<A,A>(); }
- B convert(A x){
- return (B) x;
- }
- List<B> convertList(List<A> x){
- return (List<B>) x;
- }
- Iterator<B> convertIterator(Iterator<A> x){
- return (Iterator<B>) x;
- }
- // forall generics types
- /*
- F<B> convert(F<A> x){
- return (F<B>) x;
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement