using System.Collections.Generic; using System.Linq; using UnityEngine.Purchasing.Utils; namespace UnityEngine.Purchasing.Models { static class AndroidJavaObjectExtensions { internal static IEnumerable Enumerate(this AndroidJavaObject androidJavaList) { var size = androidJavaList?.Call("size") ?? 0; return Enumerable.Range(0, size).Select(i => androidJavaList.Call("get", i)); } internal static IEnumerable EnumerateAndWrap(this AndroidJavaObject androidJavaList) { return androidJavaList.Enumerate().Wrap(); } internal static IEnumerable Wrap(this IEnumerable androidJavaList) { return androidJavaList.Select(javaObject => javaObject.Wrap()); } internal static IAndroidJavaObjectWrapper Wrap(this AndroidJavaObject androidJavaObject) { return new AndroidJavaObjectWrapper(androidJavaObject); } } }