@Test public void testMoveToBottom() throws Exception { Object obj1 = new Object(); Object obj2 = new Object(); Object obj3 = new Object(); LinkedList list = new LinkedList(); list.add(obj1); list.add(obj2); list.add(obj3); assertEquals(obj1, list.getFirst()); assertEquals(obj3, list.getLast()); ListOrganizer organizer = new ListOrganizer(list); organizer.moveToBottom(obj3); assertEquals(obj2, list.getLast()); assertEquals(obj3, list.getFirst()); }
public boolean moveToBottom(ElementType key) { list.remove(key); list.add(0, key); return true; }
ListOrganizer implements ZIndexable<ElementType> { public boolean moveToBottom(ElementType key) { list.remove(key); list.add(0, key); return true; } }
ListOrganizer implements ZIndexable<ElementType> { public boolean moveToBottom(ElementType key) { list.remove(key); list.add(0, key); return true; } ListOrganizer(List<ElementType> list); }
ListOrganizer implements ZIndexable<ElementType> { public boolean moveToBottom(ElementType key) { list.remove(key); list.add(0, key); return true; } ListOrganizer(List<ElementType> list); boolean moveToTop(ElementType element); boolean moveAbove(ElementType objectToMove, ElementType reference); boolean moveBeneath(ElementType objectToMove, ElementType reference); boolean moveToBottom(ElementType key); boolean moveUp(ElementType key); boolean moveDown(ElementType key); @Override List<ElementType> elements(); void addToBottom(ElementType element); void addToTop(ElementType element); }
ListOrganizer implements ZIndexable<ElementType> { public boolean moveToBottom(ElementType key) { list.remove(key); list.add(0, key); return true; } ListOrganizer(List<ElementType> list); boolean moveToTop(ElementType element); boolean moveAbove(ElementType objectToMove, ElementType reference); boolean moveBeneath(ElementType objectToMove, ElementType reference); boolean moveToBottom(ElementType key); boolean moveUp(ElementType key); boolean moveDown(ElementType key); @Override List<ElementType> elements(); void addToBottom(ElementType element); void addToTop(ElementType element);  }