This commit is contained in:
Jeremie Panzer
2013-03-25 14:58:15 +01:00
parent 0443fbf267
commit 5b9e12a101
12 changed files with 177 additions and 37 deletions

View File

@@ -65,13 +65,14 @@ public class EntriesREST extends AbstractREST {
}
});
int lastIndex = entries.getEntries().size()
- (entries.getEntries().isEmpty() ? 0 : 1);
int from = Math.min(lastIndex, offset);
int to = limit == -1 ? lastIndex : Math.min(lastIndex, offset + limit);
List<Entry> subList = entries.getEntries().subList(from, to);
entries.setEntries(Lists.newArrayList(subList));
if (limit > -1) {
int size = entries.getEntries().size();
System.out.println(size);
int to = Math.min(size, limit);
List<Entry> subList = entries.getEntries().subList(0, to);
entries.setEntries(Lists.newArrayList(subList));
System.out.println(entries.getEntries().size());
}
return entries;
}