Skip to content

Commit

Permalink
Removed sameElements, because elementsEqual already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
orionll committed Sep 27, 2013
1 parent da35bca commit 5982b57
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 29 deletions.
7 changes: 0 additions & 7 deletions src/main/java/com/github/xtension/IterableExtensions.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -569,13 +569,6 @@ final class IterableExtensions {
}
}

/**
* Checks if the other iterable contains the same elements in the same order as this iterable.
*/
def static <T> boolean sameElements(Iterable<T> iterable, Iterable<T> other) {
iterable.iterator.sameElements(other.iterator)
}

/**
* Sums up the elements of this iterable.
*/
Expand Down
13 changes: 0 additions & 13 deletions src/main/java/com/github/xtension/IteratorExtensions.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -568,19 +568,6 @@ final class IteratorExtensions {
}
}

/**
* Checks if the other iterator contains the same elements in the same order as this iterator.
*/
def static <T> boolean sameElements(Iterator<T> iterator, Iterator<T> other) {
while (iterator.hasNext && other.hasNext) {
if (iterator.next != other.next) {
return false
}
}

!iterator.hasNext && !other.hasNext
}

/**
* Sums up the elements of this iterator.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,6 @@ class TestIterableExtensions {
org.assertj.guava.api.Assertions::assertThat(new ArrayList<Integer>().maxByOptional[-it]).isAbsent
}

@Test
def void sameElements() {
assertThat(#[].sameElements(#[])).isTrue
assertThat(#[1,2,3].sameElements(#[1,2,3])).isTrue
assertThat(#[1,2,3].sameElements(#[1,3,2])).isFalse
assertThat(#[1,2,3].sameElements(#[1,2,3,4])).isFalse
assertThat(#[1,2,3,4].sameElements(#[1,2,3])).isFalse
}

@Test
def void sumInt() {
assertThat(#[1,2,3].sumInt).isEqualTo(6)
Expand Down

0 comments on commit 5982b57

Please sign in to comment.