@Override public boolean hasNext() { if (currentMsg == null) { do { if (index >= model.getItemsCount()) { index = 0; currentMsg = null; return false; } currentMsg = model.getItemAtIndex(index++); } while (!IsPassed(currentMsg)); } return true; }