Category: Collections

java tutorials

Different Ways to Iterate over a Map in Java

Map<k, v> A Map has Set of key value pairs. One key refers to only one value as such a map cannot contain duplicate keys. package com.memorynotfound.collections.map; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * @author MemoryNotFound.com */...
java tutorials

Different Ways to Iterate over a Set in Java

Iterate over a Set A Set is a Collection that cares about uniqueness, it doesn’t allow duplicate elements. The .equals() method determines whether two objects are identical in witch case only one object can be in...