-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
54 changed files
with
157 additions
and
93 deletions.
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
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
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
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
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
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
58 changes: 58 additions & 0 deletions
58
querydsl-libraries/querydsl-core/src/main/java/com/querydsl/core/CloseableIterator.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,58 @@ | ||
package com.querydsl.core; | ||
|
||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.Spliterator; | ||
import java.util.Spliterators; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.StreamSupport; | ||
|
||
public interface CloseableIterator<T> extends Iterator<T>, AutoCloseable { | ||
|
||
@Override | ||
void close(); | ||
|
||
public static <E> List<E> asList(CloseableIterator<E> iterator) { | ||
try (iterator) { | ||
return StreamSupport.stream( | ||
Spliterators.spliteratorUnknownSize(iterator, Spliterator.ORDERED), false) | ||
.collect(Collectors.toList()); | ||
} | ||
} | ||
|
||
public static <E> CloseableIterator<E> of(Iterator<E> iterator) { | ||
return of(iterator, () -> {}); | ||
} | ||
|
||
public static <E> CloseableIterator<E> of(CloseableIterator<E> iterator) { | ||
return of(iterator, iterator); | ||
} | ||
|
||
public static <E> CloseableIterator<E> of(Iterator<E> iterator, AutoCloseable closeable) { | ||
return new CloseableIterator<E>() { | ||
|
||
@Override | ||
public boolean hasNext() { | ||
return iterator.hasNext(); | ||
} | ||
|
||
@Override | ||
public E next() { | ||
return iterator.next(); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
try { | ||
closeable.close(); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
}; | ||
} | ||
|
||
public static <E> List<E> asList(Iterator<E> iterator) { | ||
return asList(of(iterator)); | ||
} | ||
} |
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
18 changes: 18 additions & 0 deletions
18
querydsl-libraries/querydsl-core/src/main/java/com/querydsl/core/Pair.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,18 @@ | ||
package com.querydsl.core; | ||
|
||
public record Pair<F, S>(F first, S second) { | ||
|
||
@Deprecated | ||
public F getFirst() { | ||
return first(); | ||
} | ||
|
||
@Deprecated | ||
public S getSecond() { | ||
return second(); | ||
} | ||
|
||
public static <T, U> Pair<T, U> of(T key, U value) { | ||
return new Pair<>(key, value); | ||
} | ||
} |
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
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
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
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
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
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
2 changes: 1 addition & 1 deletion
2
...sl-libraries/querydsl-core/src/test/java/com/querydsl/core/group/AbstractGroupByTest.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
Oops, something went wrong.