Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Map Interface in Java

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 221
    Comment on it

    We use Map Interface for mapping unique keys and values. By using these keys, we can retrieve the mapping values at any time. Map Interface has so many methods. Some of them are given below :-

  • clear() : It clears all pairs from the given map.
  • boolean containsKey(Object thisKey) : It will return true if the map contains thisKey as a key.
  • boolean containsValue(Object thisValue) : It will return true if the map contains thisValue as a value.
  • Object put(Object key, Object value): It will add this pairs to the given Map and overwrite the value if
    key already exist.
  • int size() : Returns the number of pairs in the given Map.

    Example:

    Map mapExample = new HashMap();
    mapExample.put(k1,Java1);
    mapExample.put(k2,Java2);
    mapExample.put(k3,Java3);
    mapExample.put(k4,Java4);
    System.out.println(Map : : +mapExample);
Comment on it

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: