Array of Primitives: Support queries
See original GitHub issueSplit from https://github.com/realm/realm-java/pull/5031
We need to add support for arrays of values to RealmQuery. Based on API discussions we don’t want to add a ton of extra methods, so instead we are going to use the empty field name "" when querying arrays of primitives.
E.g
public class Person extends RealmObject {
public RealmList<String> names;
}
// Query list in object
RealmResults<Person> results = realm.where(Person.class).equalTo("names", "John").findAll();
This also include support for RealmList.min()/max()/average()/sum()/minDate()/maxDate() which depends on the query system
Out of scope for now
// Query list directly
Person p = getPerson();
RealmResults<String> results = p.names.where().like("", "Jo*").findAll();
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:15 (10 by maintainers)
Top Results From Across the Web
Chronicle Map support for arrays of primitives? - Stack Overflow
1 Answer 1 ... Chronicle Values are designed as constant-sized structures. If you need to store some variable-sized fields e. g. CharSequences ( ......
Read more >Array Initialization | Java Operators with Primitives and Objects
Arrays of primitives have elements that are initialized to default values. Arrays of objects have the value null in each element. You are ......
Read more >Is an array a primitive type or an object in Java?
In Java programming language, arrays are objects which are dynamically created, and may be assigned to variables of type Object. All methods of ......
Read more >Array Data Types - int Array, Double array, Array of Strings Etc.
This tutorial will walk you through Java arrays with different data types and discuss their usage in Java programs through simple examples.
Read more >Execute a Query that Returns a Primitive Type - Documentation
Documentation about How to: Execute a Query that Returns a Primitive Type in Data Access Classic. Get the help you need online.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hi, Any update on this much needed feature? It’s 2019 and I don’t think using a wrapper seems agreeable anymore. If anyone has a workaround apart from flatlists, I would love to learn!
@mgohin another option of course is to map the list into a single string field with some convention like
|value1|value2|value3|and thencontains("flatList", "|${searchValue}|")But that’s lame that we still have to do that, i agree