Map.Entry Interface

Map.Entry Interface -
    Map.Entry Interface is used to hold the view of key-value pair from Map.
Map interface has a method entrySet() which returns the Set object that holds the key value pair. You can iterate the key and value from getKey() and getValue().
You can also set value an element by the setValue() method.

List of methods within the Map.Entry Interface -

 boolean equals(Object o) -
         This method is used to compares the specified object with this entry. If both are equal it return true otherwise return false.

 K getKey() -
    This method returns the key of map.

 V getValue() -
    This method returns the value of corresponding to this entry.

 int hashCode() -
    This method is used to return the hash code value for this map entry.

 V setValue(V value) -
    This method is used to set the values at  corresponding the key.

Example -
public class Test {
    public static void main(String[] args) {
        Map map = new HashMap();
        Iterator s = map.entrySet().iterator();
            Map.Entry m = (Map.Entry);


Popular posts from this blog

What is NBioBSP Java Library?

Draw arrow line example

Capture image from webcam java code, examples