@Override
   public boolean equals(Object o) {
      if (this == o)
         return true;
      if (o == null || !(o instanceof Set))
         return false;

      if (o instanceof RangeSet) {
         RangeSet integers = (RangeSet) o;

         return size == integers.size;
      } else {
         Set set = (Set) o;
         return size == set.size() && containsAll(set);
      }
   }
@Test
   public void equals() throws Exception {
      RangeSet rs = new RangeSet(4);

      RangeSet rs2 = new RangeSet(5);

      // Verify equals both ways
      assertNotEquals(rs, rs2);
      assertNotEquals(rs2, rs);

      RangeSet rs3 = new RangeSet(4);

      assertEquals(rs3, rs);
      assertEquals(rs, rs3);
   }