int selectedPage(List items) { for (int i = 0; i < items.length; i++) { if (isPageSelected(i)) { return i; } } return 0; }