-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Implement array expressions #1043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ | |
import java.util.function.BinaryOperator; | ||
import java.util.function.Function; | ||
|
||
import static com.mongodb.client.model.expressions.Expressions.of; | ||
|
||
/** | ||
* Expresses an array value. An array value is a finite, ordered collection of | ||
* elements of a certain type. | ||
|
@@ -61,4 +63,29 @@ public interface ArrayExpression<T extends Expression> extends Expression { | |
*/ | ||
T reduce(T initialValue, BinaryOperator<T> in); | ||
|
||
IntegerExpression size(); | ||
|
||
T elementAt(IntegerExpression i); | ||
|
||
default T elementAt(final int i) { | ||
return this.elementAt(of(i)); | ||
} | ||
|
||
T first(); | ||
|
||
T last(); | ||
|
||
BooleanExpression contains(T contains); | ||
|
||
ArrayExpression<T> concat(ArrayExpression<T> array); | ||
|
||
ArrayExpression<T> slice(IntegerExpression start, IntegerExpression length); | ||
|
||
default ArrayExpression<T> slice(final int start, final int length) { | ||
return this.slice(of(start), of(length)); | ||
} | ||
|
||
ArrayExpression<T> union(ArrayExpression<T> set); | ||
|
||
ArrayExpression<T> distinct(); | ||
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.