Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void previous(List<ContentType> list) {
- ContentType current = list.getContent();
- if(current != null) {
- list.toFirst();
- // Position, an der das aktuelle Element liegt
- int oldPosition = 0;
- while(list.hasAccess()) {
- // Solange wir nicht am Ende sind
- if(list.getContent() == current) {
- break;
- }
- oldPosition++;
- }
- list.toFirst();
- for(int i = 0; i < oldPosition - 1; i++) {
- // Immer next() bis wir ein Element vor dem alten aktuellen sind
- list.next();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement