I wanted to compare an array value with another array in firestore The code below works as "ingredients" is an array in firestore, and "sugar" is what the ingredients compare to but i want to make "ingredients" compare to my String[] array value 1 by 1 For example if : String[] a = {"sugar","b","c"} , then this should be true String[] b = {"salt","pepper"}, then this will false. I have commented in my code for a more clearer need.
Putting Arrays.asList(test) didnt work. Any solution?
List<String> ingreList;
String[] ingredientLists;
String[] test = {"sugar","b"};
private void checkTesting() {
postRef.whereArrayContains("ingredients", "sugar" /*PUTTING STRING[] HERE TO COMPARE OR ARRAYLIST STRING IS ALSO FINE TOO (I HAVE BOTH) */)
.get()
.addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
postLists3.clear();
for(QueryDocumentSnapshot documentSnapshot: queryDocumentSnapshots){
Post post = documentSnapshot.toObject(Post.class);
postLists3.add(post);
}
postAdapter.notifyDataSetChanged();
progressBar.setVisibility(View.GONE);
}
});
}