• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.queryable.queries;
18 
19 import com.android.queryable.Queryable;
20 
21 import java.util.Collection;
22 import java.util.List;
23 
24 /** Query for a {@link java.util.List}. */
25 public interface ListQuery<E extends Queryable, F, G extends Query<F>> extends Query<List<F>> {
26 
list()27     static ListQuery<ListQuery<?, ?, ?>, ?, ?> list() {
28         return new ListQueryHelper<>();
29     }
30 
size()31     IntegerQuery<E> size();
32 
33     /**
34      * Used to query whether a list contains certain objects.
35      */
contains(G... objects)36     E contains(G... objects);
37 
38     /**
39      * Used to query whether a list contains certain objects.
40      *
41      * <p>There are no bounds on the type for this method and therefore to find matches objects are
42      * compared using {@link Object#equals} If you are not checking for equality use
43      * {@link #contains(Query[])}.
44      */
contains(F... objects)45     E contains(F... objects);
46 
47     /**
48      * Used to query whether a list does not contain certain objects.
49      */
doesNotContain(G... objects)50     E doesNotContain(G... objects);
51 
52     /**
53      * Used to query whether a list does not contain certain objects.
54      *
55      * <p>There are no bounds on the type for this method and therefore to find matches objects are
56      * compared using {@link Object#equals}. If you are not checking for equality use
57      * {@link #contains(Query[])}.
58      */
doesNotContain(F... objects)59     E doesNotContain(F... objects);
60 
61     /**
62      * Used to query whether a list contains all of the elements from a collection.
63      *
64      * <p>There are no bounds on the type for this method and therefore to find matches objects are
65      * compared using {@link Object#equals} If you are not checking for equality use
66      * {@link #contains(Query[])}.
67      */
containsAll(H... collection)68     <H extends Collection<F>> E containsAll(H... collection);
69 
70     /**
71      * Used to query whether a list does not contain any elements given in a collection.
72      *
73      * <p>There are no bounds on the type for this method and therefore to find matches objects are
74      * compared using {@link Object#equals} If you are not checking for equality use
75      * {@link #contains(Query[])}.
76      */
doesNotContainAny(H... collections)77     <H extends Collection<F>> E doesNotContainAny(H... collections);
78 }
79