You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/10/23 15:27:44 UTC
[groovy] branch GROOVY-8258 updated: GROOVY-8258: tweak method
signatures
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY-8258
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY-8258 by this push:
new 559a848 GROOVY-8258: tweak method signatures
559a848 is described below
commit 559a8480897eb65987c808fdc6ae61acfb8760e5
Author: Daniel Sun <su...@apache.org>
AuthorDate: Fri Oct 23 23:27:13 2020 +0800
GROOVY-8258: tweak method signatures
---
.../org/apache/groovy/linq/provider/collection/Queryable.java | 6 +++---
.../apache/groovy/linq/provider/collection/QueryableCollection.java | 4 ++--
.../groovy/linq/provider/collection/QueryableCollectionTest.groovy | 1 +
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/Queryable.java b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/Queryable.java
index c66e143..b893c89 100644
--- a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/Queryable.java
+++ b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/Queryable.java
@@ -65,7 +65,7 @@ public interface Queryable<T> {
Queryable<T> where(Predicate<? super T> filter);
- <K> Queryable<Tuple2<K, Queryable<T>>> groupBy(Function<? super T, ? extends K> classifier, Predicate<? super Tuple2<K, Queryable<T>>> having);
+ <K> Queryable<Tuple2<K, Queryable<T>>> groupBy(Function<? super T, ? extends K> classifier, Predicate<? super Tuple2<? extends K, Queryable<? extends T>>> having);
default <K> Queryable<Tuple2<K, Queryable<T>>> groupBy(Function<? super T, ? extends K> classifier) {
return groupBy(classifier, null);
@@ -73,9 +73,9 @@ public interface Queryable<T> {
<U extends Comparable<? super U>> Queryable<T> orderBy(Order<? super T, ? extends U>... orders);
- Queryable<T> limit(int offset, int size);
+ Queryable<T> limit(long offset, long size);
- default Queryable<T> limit(int size) {
+ default Queryable<T> limit(long size) {
return limit(0, size);
}
diff --git a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/QueryableCollection.java b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/QueryableCollection.java
index 5a79f58..9cd6a0d 100644
--- a/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/QueryableCollection.java
+++ b/subprojects/groovy-linq/src/main/groovy/org/apache/groovy/linq/provider/collection/QueryableCollection.java
@@ -108,7 +108,7 @@ class QueryableCollection<T> implements Queryable<T>, Serializable {
}
@Override
- public <K> Queryable<Tuple2<K, Queryable<T>>> groupBy(Function<? super T, ? extends K> classifier, Predicate<? super Tuple2<K, Queryable<T>>> having) {
+ public <K> Queryable<Tuple2<K, Queryable<T>>> groupBy(Function<? super T, ? extends K> classifier, Predicate<? super Tuple2<? extends K, Queryable<? extends T>>> having) {
Stream<Tuple2<K, Queryable<T>>> stream =
this.stream()
.collect(Collectors.groupingBy(classifier, Collectors.toList()))
@@ -139,7 +139,7 @@ class QueryableCollection<T> implements Queryable<T>, Serializable {
}
@Override
- public Queryable<T> limit(int offset, int size) {
+ public Queryable<T> limit(long offset, long size) {
Stream<T> stream = this.stream().skip(offset).limit(size);
return from(stream);
diff --git a/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/provider/collection/QueryableCollectionTest.groovy b/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/provider/collection/QueryableCollectionTest.groovy
index fd925cb..ef76391 100644
--- a/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/provider/collection/QueryableCollectionTest.groovy
+++ b/subprojects/groovy-linq/src/test/groovy/org/apache/groovy/linq/provider/collection/QueryableCollectionTest.groovy
@@ -36,6 +36,7 @@ class QueryableCollectionTest {
void testFrom() {
assert [1, 2, 3] == from(Stream.of(1, 2, 3)).toList()
assert [1, 2, 3] == from(Arrays.asList(1, 2, 3)).toList()
+ assert [1, 2, 3] == from(from(Arrays.asList(1, 2, 3))).toList()
}
@Test