Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize DropIterable to not delegate to an iterator.
- Loading branch information
Showing
2 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...java8/src/test/java/org/eclipse/collections/test/lazy/DropIterableTestNoIteratorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2016 Goldman Sachs. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* and Eclipse Distribution License v. 1.0 which accompany this distribution. | ||
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html | ||
* and the Eclipse Distribution License is available at | ||
* http://www.eclipse.org/org/documents/edl-v10.php. | ||
*/ | ||
|
||
package org.eclipse.collections.test.lazy; | ||
|
||
import org.eclipse.collections.api.LazyIterable; | ||
import org.eclipse.collections.api.list.MutableList; | ||
import org.eclipse.collections.impl.lazy.DropIterable; | ||
import org.eclipse.collections.test.IterableTestCase; | ||
import org.eclipse.collections.test.LazyNoIteratorTestCase; | ||
import org.eclipse.collections.test.list.mutable.FastListNoIterator; | ||
import org.eclipse.junit.runners.Java8Runner; | ||
import org.junit.runner.RunWith; | ||
|
||
@RunWith(Java8Runner.class) | ||
public class DropIterableTestNoIteratorTest implements LazyNoIteratorTestCase | ||
{ | ||
@Override | ||
public <T> LazyIterable<T> newWith(T... elements) | ||
{ | ||
MutableList<T> list = new FastListNoIterator<>(); | ||
IterableTestCase.addAllTo(elements, list); | ||
return new DropIterable<>(list, 0); | ||
} | ||
} |