From e55db317f2d26f9edc253771b9f983693d47f3ea Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Sun, 28 Apr 2013 23:57:35 +0000 Subject: [PATCH] Ensure oddness check works even for negative numbers git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1476868 13f79535-47bb-0310-9956-ffa450edef68 --- .../collections4/iterators/FilterListIteratorTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java index e669db11b..80690a014 100644 --- a/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java +++ b/src/test/java/org/apache/commons/collections4/iterators/FilterListIteratorTest.java @@ -65,7 +65,7 @@ public class FilterListIteratorTest extends TestCase { for (int i = 0; i < 20; i++) { list.add(Integer.valueOf(i)); if (i % 2 == 0) { evens.add(Integer.valueOf(i)); } - if (i % 2 == 1) { odds.add(Integer.valueOf(i)); } + if (i % 2 != 0) { odds.add(Integer.valueOf(i)); } if (i % 3 == 0) { threes.add(Integer.valueOf(i)); } if (i % 4 == 0) { fours.add(Integer.valueOf(i)); } if (i % 6 == 0) { sixes.add(Integer.valueOf(i)); } @@ -91,7 +91,7 @@ public class FilterListIteratorTest extends TestCase { oddPred = new Predicate() { public boolean evaluate(final Integer x) { - return x % 2 == 1; + return x % 2 != 0; //works for all numbers, not just >= 0 as is the case for "x % 2 == 1" } };