View RSS Feed

Overloading

Overloading in Java

  1. How to do Overloading with Generics

    by , 11-29-2011 at 04:12 PM
    Overloading is a technique often used in object orientated programming languages such as java. In the context of generics unfortunately, classic type of overloading will produce a compile time error because of erasure.

    Java Code:
    import java.util.List;
    
    public class OverloadingExample<W, T> {
    	void f(List<T> v) {
    	}
    
    	void f(List<W> v) {
    	}
    }

    What you must do to overcome this problem is to provide ...