ScreenBackstack { public List<Screen> asList() { Screen[] array = backStack.toArray(new Screen[backStack.size()]); List<Screen> list = Arrays.asList(array); Collections.reverse(list); return list; }  void pop(); boolean isEmpty(); Screen peek(); void push(Screen screen); void clear(); List<Screen> asList();  }
@Test public void asList() { Screen1 screen1 = new Screen1(); Screen2 screen2 = new Screen2(); backStack.push(screen1); backStack.push(screen2); List<Screen> list = backStack.asList(); assertEquals(screen1, list.get(0)); assertEquals(screen2, list.get(1)); }