java - How to upper bound a map's value type -
java - How to upper bound a map's value type -
when should 1 of these preferred another?
public static void dostuffwithit_a( map<integer, ? extends object > thethings){ ...} public static void dostuffwithit_b( map<integer, ? > thethings){ ...} public static void dostuffwithit_c( map<integer, object > thethings){ ...} i've been using variable parameters passing interface in java, inspired python's "**kw"argument syntax, , i'm trying 'more right'
by using object, first , sec alternative same thing. there important differences between 2 , 3rd option, however. consider calling methods. if 1 has map<integer, string>, phone call first 2, not 3rd option. within method itself, 3rd alternative allow method insert info map (without resorting dropping generic definition , - optionally - casting arg).
java generics bounded-wildcard
Comments
Post a Comment