Skip to content

Commit

Permalink
Use JavaObject constructor instead of addding individual items
Browse files Browse the repository at this point in the history
This is to avoid an issue in dotnet/android that is resulting in incosistent
behaviour when a List has duplicate items.

#392
  • Loading branch information
cagz committed Jan 13, 2025
1 parent a9f5ae1 commit 364eb1c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Firestore/Platforms/Android/Extensions/ListExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ public static IList ToList(this JavaList @this, Type targetType = null)

public static JavaList ToJavaList(this IEnumerable @this)
{
var list = new JavaList();
foreach(var item in @this) {
// Refactored to address https://github.com/TobiasBuchholz/Plugin.Firebase/issues/392
var list = new List<object>();
foreach (var item in @this)
{
list.Add(item.ToJavaObject());
}
return list;
return new JavaList(list);;
}

}

0 comments on commit 364eb1c

Please sign in to comment.