code: public void removeItem(int index) {
          if (index < 0 || index >= items.size()) {
              return;
          }
          int originSize = items.size();
          items.remove(index);
          if (currentItemIndex == index) {
              // set the next item.
              if (index == originSize - 1) {
                  currentItemIndex = index - 1;
              }
          }
      }
docs: {@inheritDoc}