   Java: BFS implementation question
  In BFS I need to keep track of whether or not a node has been visited. I therefore want to put all visited nodes in a hash map so I can tell in O(1) time whether or not something has been visited (not using a bool visited data member). If the node is the key, then there's no point in wasting space with a value since I just want to check if the entry exists. So my question is, is there some sort of hash map that basically consists of only the key with no value?   
  Did you try HashSet?   ;  Ok HashSet sounds right. So from what I understand HashMaps are <key,value> pairs, HashSets are just values. However, the javadocs say this about HashSets "This class implements the Set interface, backed by a hash table (actually a HashMap instance)" which makes me wonder, whats the value part of that HashMap instance that a HashSet uses.   