According to this question: How to preserve insertion order in HashMap?
HashMap makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.
But then i have a question about an oracle tutorial
public void updateCoffeeSales(HashMap<String, Integer> salesForWeek)
    throws SQLException {
    ...
    try {
        ...
        for (Map.Entry<String, Integer> e : salesForWeek.entrySet()) {
            updateSales.setInt(1, e.getValue().intValue());
            updateSales.setString(2, e.getKey());
            updateSales.executeUpdate();
            updateTotal.setInt(1, e.getValue().intValue());
            updateTotal.setString(2, e.getKey());
            updateTotal.executeUpdate();
            con.commit();
        }
    } catch (SQLException e ) {
        ...
    } finally {
       ...
    }
it's from here: http://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html
How do they know that values for updateSales & updateTotal will not be mixed?
 
     
    