434435436437438439440441442443444445446447448449
if(i < posts.size() - 1){ post.setPrevious(posts.get(i + 1)); } }*/ Iterator<Post> it = posts.iterator(); Post prev = null; Post curr = null; while(it.hasNext()){ curr = it.next(); if(prev != null){ prev.setPrevious(curr); curr.setNext(prev); } prev = curr; } }