Friday, 6 September 2013

Size of HashMap

Size of HashMap

How to get the number of time windows in the below example? Currently it
says that there are 2 time windows, though there are 3 time windows, each
defined by open and close times.
Map<String, String> _timeWindows = new HashMap<String, String>();
_timeWindows.put("open", "123");
_timeWindows.put("close", "124");
_timeWindows.put("open", "523");
_timeWindows.put("close", "524");
_timeWindows.put("open", "823");
_timeWindows.put("close", "824");
System.out.println(_timeWindows.size());

No comments:

Post a Comment