/** Sorts the index in the order of the date of publication of the posts. */ protected void sortIndexes() { for (SingleIndex s : indexList) { for (int i = 0; i < postsPerIndex && !queue.isEmpty(); i++) { s.getPosts().add(queue.remove()); } } }