PredicateIntervalStore { public int[] get(int intervalRef) { assert intervalRef < intervalsList.length; return intervalsList[intervalRef]; } PredicateIntervalStore(int[][] intervalsList); int[] get(int intervalRef); void writeToOutputStream(DataOutputStream out); static PredicateIntervalStore fromInputStream(DataInputStream in);  }
@Test public void requireThatEqualIntervalListsReturnsSameReference() { PredicateIntervalStore.Builder builder = new PredicateIntervalStore.Builder(); List<Integer> intervals1 = Arrays.asList(0x00010001, 0x00020002); List<Integer> intervals2 = Arrays.asList(0x00010001, 0x00020002); int ref1 = builder.insert(intervals1); int ref2 = builder.insert(intervals2); PredicateIntervalStore store = builder.build(); int[] a1 = store.get(ref1); int[] a2 = store.get(ref2); assertTrue(a1 == a2); }