Prev Next

Java / Generics

How do you create a generic method which accepts generic types and return a generic type?

Replace all the raw type with the generic types like E,K, V etc and also add the list of generic types before the return type using <>.

public <K,V> V StoreThePair(K key, V value) {
                              return V;
}

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Node js

Comments & Discussions