Search:

Type: Posts; User: copeg

Search: Search took 0.18 seconds.

  1. Replies
    7
    Views
    2,660

    Re: Variable Type-Checking

    a) Define your class to be Generic


    public class TestModel<K>{


    b) no need for the generic near the public


    public void add(K fieldType, K value)//remove the 'public<K>'
  2. Replies
    7
    Views
    2,660

    Re: Variable Type-Checking

    May or may not suit this scenario, but you could extend one of the types from the other


    public class MyClass<V, T extends V>{
    ///my class
    public void function(V v, T t){

    }
    }
Results 1 to 2 of 2