"Any" means "at least one". Use this tag for questions that deal with testing elements in a collection to see if at least one of them passes a condition.
Questions tagged [any]
682 questions
21
votes
2 answers
The generic parameters Any of kotlin are converted to wildcards(?)
I encountered an issue when I used kotlin and retrofit2,The generic parameters of kotlin are converted to wildcards(?),but not in java.
now, I need a parameter Map(The key is the String type, the value is not fixed) in java,convert…

like
- 263
- 2
- 6
20
votes
5 answers
Linq To Entities - Any VS First VS Exists
I am using Entity Framework and I need to check if a product with name = "xyz" exists ...
I think I can use Any(), Exists() or First().
Which one is the best option for this kind of situation? Which one has the best performance?
Thank You,
Miguel

Miguel Moura
- 36,732
- 85
- 259
- 481
19
votes
3 answers
type any? has no subscript members
I want to get Addresses from profile dictionary,but I got the error "type any? has no subscript members"
var address:[[String : Any]] = [["Address": "someLocation", "City": "ABC","Zip" : 123],["Address": "someLocation", "City": "DEF","Zip" :…

KKG
- 299
- 1
- 4
- 11
18
votes
5 answers
Why does Typescript allow to assign an "any" object type to class object?
I have a class object:
groupNameData: GroupNameData = new GroupNameData();
and I have an any object
groupNameDatas: any;
Assignment 1 (class = any)
I just assigned the class object values to any object, like
this.groupNameDatas =…

Ramesh Rajendran
- 37,412
- 45
- 153
- 234
18
votes
6 answers
"Any" boolean function in jquery
Is there any easy way to check if any elements in a jquery selector fulfill a condition? For instance, to check if any textboxes in a form are empty (kind of pseudo, not real jquery):
$('input.tb').any(val().length == 0);
Note: I know it could be…

Wilson
- 8,570
- 20
- 66
- 101
18
votes
10 answers
Python, Press Any Key To Exit
So, as the title says, I want a proper code to close my python script.
So far, I've used input('Press Any Key To Exit'), but what that does, is generate an error.
I want a code that closes your script without using an error.
Does anyone have an…

Joppe De Cuyper
- 394
- 1
- 6
- 17
17
votes
1 answer
Using google.protobuf.Any in python file
I have such .proto file
syntax = "proto3";
import "google/protobuf/any.proto";
message Request {
google.protobuf.Any request_parameters = 1;
}
How can I create Request object and populate its fields? I tried this:
import ma_pb2
from…

Kenenbek Arzymatov
- 8,439
- 19
- 58
- 109
16
votes
4 answers
Find rows where text array contains value similar to input
I'm trying to get rows where a column of type text[] contains a value similar to some user input.
What I've thought and done so far is to use the 'ANY' and 'LIKE' operator like this:
select * from someTable where '%someInput%' LIKE…

Jose Hermosilla Rodrigo
- 3,513
- 6
- 22
- 38
16
votes
2 answers
SQLAlchemy filter query "column LIKE ANY (array)"
Hi SQLAlchemy experts out there, here's a tricky one for you:
I'm trying to write a query that resolves into something like:
SELECT * FROM MyTable where my_column LIKE ANY (array['a%', 'b%'])
using SQLAlchemy:
foo = ['a%', 'b%']
# this works, but…

user1599438
- 158
- 1
- 1
- 5
15
votes
4 answers
What is the difference between any and any[ ]?
What is the difference between any and any[ ]?
Example 1 (working as expected)
name1: any;
name2: any[];
this.name1 = this.name2;
Example 2 (This is also working as expected)
name1: any;
name2: any[];
this.name2 = this.name1;
Why typescript…

Ramesh Rajendran
- 37,412
- 45
- 153
- 234
13
votes
2 answers
Python: Lazy Function Evaluation in any() / all()
Logical operators in Python are lazy. With the following definition:
def func(s):
print(s)
return True
calling the or operator
>>> func('s') or func('t')
's'
only evaluates the first function call, because or recognizes that the expression…

Jonathan Scholbach
- 4,925
- 3
- 23
- 44
12
votes
3 answers
Check if a list contains all of another lists items when comparing on one property
I am learning Linq and I have two object lists. I want to compare one of these lists against the other to see if all of one of the properties of the objects within it can be matched to those in the other list.
So, I provide code for that but I want…
user8981612
12
votes
5 answers
How to find what matched in any() with Python?
I'm working in Python, using any() like so to look for a match between a String[] array and a comment pulled from Reddit's API.
Currently, I'm doing it like this:
isMatch = any(string in comment.body for string in myStringArray)
But it would…

Danny B
- 121
- 1
- 4
11
votes
1 answer
Are SQL ANY and SOME keywords synonyms in all SQL dialects?
In Postgres, ANY and SOME are synonyms when used on the right hand side of a predicate expression. For example, these are the same:
column = ANY (SELECT ...)
column = SOME (SELECT ...)
This is documented…

Lukas Eder
- 211,314
- 129
- 689
- 1,509
11
votes
1 answer
Python any() + generator expression
According to the blog post here, an any() + generator expression should run quicker than a for loop, and it seems like his reasoning makes sense.
But I've tried to use this method (albeit on some other function), but it seems to take a longer time…

user3366882
- 111
- 1
- 4