So here is my code:
public static void getArmor(String treasure) throws FileNotFoundException{ Random rand=new Random(); Scanner file=new Scanner
Another situation which issues the same problem, map.entrySet().iterator().next()
map.entrySet().iterator().next()
If there is no element in the Map object, then the above code will return NoSuchElementException. Make sure to call hasNext() first.
NoSuchElementException
hasNext()