public AdaptiveSparseItemIterator(ItemItemBuildContext context, LongSet users, long lowerBound) { this.context = context; this.users = users; this.lowerBound = lowerBound; if (lowerBound == Long.MIN_VALUE) { universeSize = context.getItems().size(); } else { // since universe size is only used for sparsity estimation, it is // fine to have an off-by-1 discrepancy between this & iterator behavior universeSize = context.getItems().tailSet(lowerBound).size(); } seen = new LongOpenHashSet(context.getItems().size()); userIter = users.iterator(); }
@Test public void testTailSet() { long[] data = {0, 5, 2, 6, 1}; LongSortedSet set = new LongSortedArraySet(data); assertEquals(data.length, set.size()); testSetSimple(set.tailSet(2)); }
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override default LongSortedSet tailSet(final Long from) { return tailSet(from.longValue()); } /**
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public LongSortedSet tailSet(final Long from) { return new SynchronizedSortedSet(sortedSet.tailSet(from), sync); } }
/** * {@inheritDoc} * * @deprecated Please use the corresponding type-specific method instead. */ @Deprecated @Override public LongSortedSet tailSet(final Long from) { return new UnmodifiableSortedSet(sortedSet.tailSet(from)); } }
@Override public LongSortedSet tailSet(final long from) { return new SynchronizedSortedSet(sortedSet.tailSet(from), sync); } @Override
@Override public LongSortedSet tailSet(final long from) { return new UnmodifiableSortedSet(sortedSet.tailSet(from)); } @Override
public AdaptiveSparseItemIterator(ItemItemBuildContext context, LongSet users, long lowerBound) { this.context = context; this.users = users; this.lowerBound = lowerBound; if (lowerBound == Long.MIN_VALUE) { universeSize = context.getItems().size(); } else { // since universe size is only used for sparsity estimation, it is // fine to have an off-by-1 discrepancy between this & iterator behavior universeSize = context.getItems().tailSet(lowerBound).size(); } seen = new LongOpenHashSet(context.getItems().size()); userIter = users.iterator(); }