diff --git a/src/test/java/com/github/underscore/CollectionsTest.java b/src/test/java/com/github/underscore/CollectionsTest.java index 3daeb825..3fe01ef5 100644 --- a/src/test/java/com/github/underscore/CollectionsTest.java +++ b/src/test/java/com/github/underscore/CollectionsTest.java @@ -1301,26 +1301,25 @@ void sortWith() { Underscore.sortWith( asList(1, 2, 3, 4, 5, 6), (item1, item2) -> - Double.valueOf(Math.sin(item1) * 1000).intValue() - - Double.valueOf(Math.sin(item2) * 1000).intValue()); + (int) (Math.sin(item1) * 1000) + - (int) (Math.sin(item2) * 1000)); assertEquals("[5, 4, 6, 3, 1, 2]", result.toString()); final List resultObj = new Underscore(asList(1, 2, 3, 4, 5, 6)) .sortWith( (Comparator) (item1, item2) -> - Double.valueOf(Math.sin(item1) * 1000).intValue() - - Double.valueOf(Math.sin(item2) * 1000) - .intValue()); + (int) (Math.sin(item1) * 1000) + - (int) (Math.sin(item2) * 1000)); assertEquals("[5, 4, 6, 3, 1, 2]", resultObj.toString()); final List resultChain = Underscore.chain(asList(1, 2, 3, 4, 5, 6)) .sortWith( (Comparator) (item1, item2) -> - Double.valueOf(Math.sin(item1) * 1000).intValue() - - Double.valueOf(Math.sin(item2) * 1000) - .intValue()) + (int) (Math.sin(item1) * 1000) + - (int) (Math.sin(item2) * 1000) + ) .value(); assertEquals("[5, 4, 6, 3, 1, 2]", resultChain.toString()); } @@ -1335,17 +1334,17 @@ void sortBy() { final List result = Underscore.sortBy( asList(1, 2, 3, 4, 5, 6), - item -> Double.valueOf(Math.sin(item) * 1000).intValue()); + item -> (int) (Math.sin(item) * 1000)); assertEquals("[5, 4, 6, 3, 1, 2]", result.toString()); final List resultObj = new Underscore(asList(1, 2, 3, 4, 5, 6)) .sortBy( (Function) - item -> Double.valueOf(Math.sin(item) * 1000).intValue()); + item -> (int) (Math.sin(item) * 1000)); assertEquals("[5, 4, 6, 3, 1, 2]", resultObj.toString()); final List resultChain = Underscore.chain(asList(1, 2, 3, 4, 5, 6)) - .sortBy(item -> Double.valueOf(Math.sin(item) * 1000).intValue()) + .sortBy(item -> (int) (Math.sin(item) * 1000)) .value(); assertEquals("[5, 4, 6, 3, 1, 2]", resultChain.toString()); }