View RSS Feed

Algorithm and Data Structure

Algorithm and data structure examples in Java.

  1. Removing Elements from Map

    by , 02-19-2012 at 08:36 AM
    From Map, the removal of elements is done by using remove (Object key) method. This would be removing pair (Key, Value) from Map.

    Any type of elements could be put into Map. Type of objects can be limited to be used for values or keys in a Map. How to limit values or keys is well explained in the given code.
    Java Code: This is the code to limit values or keys
    Map<String, MyObject> map = new HashSet<String, MyObject>();
    Map just accepts the value son MyObject type or keys of string type, ...
    Categories
    Hashmap