View RSS Feed

Advanced Java

Advanced Java programming.

  1. Generic Map in Java

    by , 02-18-2012 at 04:49 PM
    It is possible to generify java.util.Map. Instances of Map in such cases could be of a specific type. Instances of that type in that case could be only inserted as well read, from that Map.
    Java Code: This is the code to explain Generic Map
    Map<Integer, String> set = new HashMap<Integer, String>;
    This Map just can now accept string instances to be as values and Integer instances to be as Keys.

    Accessing a Generic Map

    Following code could be used for addition of String to generic ...
    Tags: generic map Add / Edit Tags
    Categories
    Generics