OpenType<?>[] types = new OpenType<?>[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.STRING, SimpleType.LONG}; while (it.hasNext()) { MailQueueItemView mView = it.next(); Mail m = mView.getMail(); Optional<ZonedDateTime> nextDelivery = mView.getNextDelivery(); data.add(c); it.close(); return data;