public synchronized int hashCode() { mergeBitSet(); final int prime = 31; int result = 1; result = prime * result + (int) version; result = prime * result + (int) (version >> 32); result = prime * result + canonicalExceptions(exceptions).hashCode(); return result; }
List<RVVException> e1 = canonicalExceptions(vh1.exceptions); List<RVVException> e2 = canonicalExceptions(vh2.exceptions); Iterator<RVVException> it1 = e1.iterator(); Iterator<RVVException> it2 = e2.iterator();
List<RVVException> mine = canonicalExceptions(this.exceptions); Iterator<RVVException> myIterator = mine.iterator(); List<RVVException> others = canonicalExceptions(other.exceptions); Iterator<RVVException> otherIterator = others.iterator();
@Test public void testCanonicalExceptions() { List<RVVException> exceptionList = new ArrayList<>(); for (int i = NUM_TEST_EXCEPTIONS; i > 0; --i) { long start = i * TEST_EXCEPTION_SIZE; long end = start + TEST_EXCEPTION_SIZE; RVVException testException = RVVException.createException(start, end); for (long j = start + 2; j < end; j += 2) { testException.add(j); } exceptionList.add(testException); } List<RVVException> canonicalExceptions = RegionVersionHolder.canonicalExceptions(exceptionList); long expectedStart = NUM_TEST_EXCEPTIONS * TEST_EXCEPTION_SIZE + TEST_EXCEPTION_SIZE - 2; for (RVVException exception : canonicalExceptions) { assertEquals(expectedStart, exception.previousVersion); assertEquals(expectedStart + 2, exception.nextVersion); assertTrue(exception.isEmpty()); expectedStart -= 2; } }