public void checkToBoundedString(String expected, int lim, LongArray array) { WritableLongSet set = LongTreeSet.createFromSortedUnique(array); LongIterable[] iterables = {array, set, array.iterator(), set.iterator(), LongIterators.unionIterator(array, array.subList(0, 1))}; for (LongIterable iterable : iterables) { assertEquals(iterable.toString(), expected, LongCollections.toBoundedString(iterable, lim)); } }
public void checkToNativeArray(LongArray array) { long[] expected = array.toNativeArray(); LongSet set = LongTreeSet.createFromSortedUnique(array); LongIterable[] iterables = {array, set, array.iterator(), set.iterator(), LongIterators.unionIterator(array, array.isEmpty() ? LongIterator.EMPTY : array.subList(0, 1))}; for (LongIterable iterable: iterables) { CHECK.order(expected, LongCollections.toNativeArray(iterable)); } }