public static PersistentTreeSet create(IComparer comp, ISeq init) { PersistentTreeSet ret = new PersistentTreeSet(null, new PersistentTreeMap(null, comp)); for (ISeq s = init; s != null; s = s.next()) ret = (PersistentTreeSet)ret.cons(s.first()); return ret; }
/// <summary> /// Create a <see cref="PersistentTreeSet">PersistentTreeSet</see> initialized from an <see cref="ISeq">ISeq</see>. /// </summary> /// <param name="init">A sequence of elements.</param> /// <returns>A <see cref="PersistentTreeSet">PersistentTreeSet</see>.</returns> public static PersistentTreeSet create(ISeq init) { PersistentTreeSet ret = EMPTY; for (ISeq s = init; s != null; s = s.next()) { ret = (PersistentTreeSet)ret.cons(s.first()); } return(ret); }
/// <summary> /// Create a <see cref="PersistentTreeSet">PersistentTreeSet</see> from arbitrary arguments. /// </summary> /// <param name="init">Array of elements.</param> /// <returns>A <see cref="PersistentTreeSet">PersistentTreeSet</see>.</returns> public static PersistentTreeSet create(params object[] init) { PersistentTreeSet ret = EMPTY; for (int i = 0; i < init.Length; i++) { ret = (PersistentTreeSet)ret.cons(init[i]); } return(ret); }
/// <summary> /// Create a <see cref="PersistentTreeSet">PersistentTreeSet</see> initialized from an IList. /// </summary> /// <param name="init">A list of elements</param> /// <returns>A <see cref="PersistentTreeSet">PersistentTreeSet</see>.</returns> public static PersistentTreeSet create(IList init) { PersistentTreeSet ret = EMPTY; foreach (object o in init) { ret = (PersistentTreeSet)ret.cons(o); } return(ret); }
public static PersistentTreeSet create(IComparer comp, ISeq init) { PersistentTreeSet ret = new PersistentTreeSet(null, new PersistentTreeMap(null, comp)); for (ISeq s = init; s != null; s = s.next()) { ret = (PersistentTreeSet)ret.cons(s.first()); } return(ret); }