   @Test
   public void testRemove ()
   {

      // Initial mutable list
      List<Integer> list = new ArrayList<> ();
      list.addAll (Arrays.asList (0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
      // Elements to remove from initial list: at least test first and last.
      List<Integer> removed = Arrays.asList (0, 1, 5, 8 ,9);
      
      int intial_list_size = list.size();
      
      Pageable<Integer> pageable = new Pageable4Test (list);
      PagedIterator<Integer> iterator = 
         new PagedIterator<Integer> (pageable, query, 0, 3);

      // Test removing some elements
      while (iterator.hasNext ())
      {
         Integer element = iterator.next ();
         if (removed.contains (element))
         {
            iterator.remove ();
            Assert.assertFalse (list.contains (element), "Removed element #" + 
               element + " still present in list.");
         }
      }
      // Check if list contains 5 elements as expected
      int expected_size = intial_list_size - removed.size(); // =5
      Assert.assertEquals(list.size(), expected_size,
          "Initial list size not reduced as expected");
      
      // Reset the iterator with the reduced list 
      pageable = new Pageable4Test (list);
      iterator = new PagedIterator<Integer> (pageable, query, 0, 3);
      // Remove all the elements
      while (iterator.hasNext())
      {
         iterator.next();
         iterator.remove();
      }
     
      try
      {
         iterator.remove (); // throws IllegalStateException
         Assert.fail ("Remove element from empty list should raise" +
            " IllegalStateException.");
      }
      catch (IllegalStateException e)
      {
         // exception expected
      }
   }