i'm trying to convert this c# class to kotlin for android:
public class ChildItemCollection<P, T, C> : ICollection<T>
where P : class
where T : ChildItem<P>
where C : class, ICollection<T>
{
private P _parent;
private C _collection;
public ChildItemCollection(P parent, C collection)
{
this._parent = parent;
this._collection = collection;
}
...
}
public class ChildItemCollection<P, T> : ChildItemCollection<P, T, List<T>>
where P : class
where T : ChildItem<P>
{
#region Constructors
public ChildItemCollection(P parent)
: base(parent, new List<T>()) { }
public ChildItemCollection(P parent, ICollection<T> collection)
: this(parent)
{
foreach (T item in collection)
this.Add(item);
}
#endregion Constructors
}
I have tried many things without success.
I didn't understand how to use the "where" lines either.