     ###
     toArray: -> @slice()
 
-    ###*
-    # default filtration function
-    #
-    ###
-
-    _filter: (val, pos) -> true
-
 
     ###*
+    comparison function. Compares two objects by this.compareKey
+
+    @method compare
+    @private
+    @param {any} a
+    @param {any} b
     ###
     compare: (a, b) ->
 



class SortedList extends Array


    constructor: (@compareKey) ->


    @create: (compareKey) ->

        new SortedList(compareKey)



    ###*
    # sorted.insertOne(val)
    # insert one value
    # returns false if failed, inserted position if succeed
    #
    ###
    insertOne: (val) ->
        pos = @bsearch(val)

        if @_unique and @key(val, pos) != null
            return false

        if !@_filter(val, pos)
            return false

        @splice pos + 1, 0, val


            mpos = Math.floor((spos + epos) / 2)
            mval = @[mpos]
            comp = @compare(val, mval)

            return mpos if comp is 0

            if comp > 0
                spos = mpos
            else
                epos = mpos

        return if spos is 0 and @compare(@[0], val) > 0 then -1 else spos


    ###*
