void (int index, int[] splitIndices) { LongArrayList toAdd = new LongArrayList(); for(LongIterator iterator = myData.iterator(); iterator.hasNext(); ) { DistinctPair pair = decode(iterator.nextLong()); if (pair.myFirst == index) { for (int splitIndex : splitIndices) { toAdd.add(createPair(splitIndex, pair.mySecond, pair.isOrdered())); } iterator.remove(); } else if (pair.mySecond == index) { for (int splitIndex : splitIndices) { toAdd.add(createPair(pair.myFirst, splitIndex, pair.isOrdered())); } iterator.remove(); } } myData.addAll(toAdd); }