use of org.eclipse.collections.impl.list.Interval in project eclipse-collections by eclipse.
the class ParallelIterateAcceptanceTest method setUp.
@Before
public void setUp() {
Interval interval = Interval.oneTo(20000);
this.iterables = Lists.immutable.of(interval.toList(), interval.toList().asUnmodifiable(), interval.toList().asSynchronized(), interval.toList().toImmutable(), interval.toSet(), interval.toSet().asUnmodifiable(), interval.toSet().asSynchronized(), interval.toSet().toImmutable(), interval.toBag(), interval.toBag().asUnmodifiable(), interval.toBag().asSynchronized(), interval.toBag().toImmutable(), interval.toSortedSet(), interval.toSortedSet().asUnmodifiable(), interval.toSortedSet().asSynchronized(), interval.toSortedSet().toImmutable(), interval.toMap(Functions.getPassThru(), Functions.getPassThru()), interval.toMap(Functions.getPassThru(), Functions.getPassThru()).asUnmodifiable(), interval.toMap(Functions.getPassThru(), Functions.getPassThru()).asSynchronized(), interval.toMap(Functions.getPassThru(), Functions.getPassThru()).toImmutable(), ArrayListAdapter.<Integer>newList().withAll(interval), ArrayListAdapter.<Integer>newList().withAll(interval).asUnmodifiable(), ArrayListAdapter.<Integer>newList().withAll(interval).asSynchronized(), new CompositeFastList<Integer>().withAll(interval.toList()), new CompositeFastList<Integer>().withAll(interval.toList()).asUnmodifiable(), new CompositeFastList<Integer>().withAll(interval.toList()).asSynchronized(), new CompositeFastList<Integer>().withAll(interval.toList()).toImmutable(), ListAdapter.adapt(new LinkedList<Integer>()).withAll(interval), ListAdapter.adapt(new LinkedList<Integer>()).withAll(interval).asUnmodifiable(), ListAdapter.adapt(new LinkedList<Integer>()).withAll(interval).asSynchronized(), UnifiedSetWithHashingStrategy.<Integer>newSet(HashingStrategies.defaultStrategy()).withAll(interval), UnifiedSetWithHashingStrategy.<Integer>newSet(HashingStrategies.defaultStrategy()).withAll(interval).asUnmodifiable(), UnifiedSetWithHashingStrategy.<Integer>newSet(HashingStrategies.defaultStrategy()).withAll(interval).asSynchronized(), UnifiedSetWithHashingStrategy.<Integer>newSet(HashingStrategies.defaultStrategy()).withAll(interval).toImmutable());
}
use of org.eclipse.collections.impl.list.Interval in project eclipse-collections by eclipse.
the class ImmutableArrayStack method zipWithIndex.
@Override
public ImmutableStack<Pair<T, Integer>> zipWithIndex() {
int maxIndex = this.delegate.size() - 1;
Interval indices = Interval.fromTo(0, maxIndex);
return ImmutableArrayStack.newStackFromTopToBottom(this.delegate.asReversed().zip(indices).toList());
}
use of org.eclipse.collections.impl.list.Interval in project eclipse-collections by eclipse.
the class ImmutableTreeMapTest method entrySet.
@Override
public void entrySet() {
super.entrySet();
Interval interval = Interval.oneTo(100);
LazyIterable<Pair<String, Integer>> pairs = interval.collect(Object::toString).zip(interval);
MutableSortedMap<String, Integer> mutableSortedMap = new TreeSortedMap<>(pairs.toArray(new Pair[] {}));
ImmutableSortedMap<String, Integer> immutableSortedMap = mutableSortedMap.toImmutable();
MutableList<Map.Entry<String, Integer>> entries = FastList.newList(immutableSortedMap.castToSortedMap().entrySet());
MutableList<Map.Entry<String, Integer>> sortedEntries = entries.toSortedListBy(Map.Entry::getKey);
Assert.assertEquals(sortedEntries, entries);
}
use of org.eclipse.collections.impl.list.Interval in project eclipse-collections by eclipse.
the class SerialParallelLazyPerformanceTest method getIntegerListGenerators.
private MutableList<Function0<FastList<Integer>>> getIntegerListGenerators(int count, boolean shuffle) {
Interval interval = Interval.fromTo(-(count / 2), count / 2 - 1);
MutableList<Function0<FastList<Integer>>> generators = FastList.newList();
generators.add(() -> {
FastList<Integer> integers = FastList.newList(interval);
if (shuffle) {
integers.shuffleThis();
}
return integers;
});
return generators.shuffleThis();
}
use of org.eclipse.collections.impl.list.Interval in project eclipse-collections by eclipse.
the class SerialParallelPerformanceTest method getIntegerListGenerators.
private MutableList<Function0<Iterable<Integer>>> getIntegerListGenerators(int count) {
Interval interval = Interval.fromTo(-(count / 2), count / 2 - 1);
MutableList<Function0<Iterable<Integer>>> generators = FastList.newList();
generators.add(() -> interval.toList().shuffleThis());
generators.add(() -> {
MutableList<Integer> integers = interval.toList().shuffleThis();
return integers.toImmutable();
});
generators.add(interval::toSet);
return generators.shuffleThis();
}
Aggregations