Method
mergeSortedLists
(a fastJsonNode, b fastJsonNode)
Source from the content-addressed store, hash-verified
| 153 | } |
| 154 | |
| 155 | func (enc *encoder) mergeSortedLists(a fastJsonNode, b fastJsonNode) fastJsonNode { |
| 156 | var result fastJsonNode |
| 157 | |
| 158 | if a == nil { |
| 159 | return b |
| 160 | } else if b == nil { |
| 161 | return a |
| 162 | } |
| 163 | |
| 164 | if enc.less(a, b) { |
| 165 | result = a |
| 166 | result.next = enc.mergeSortedLists(a.next, b) |
| 167 | } else { |
| 168 | result = b |
| 169 | result.next = enc.mergeSortedLists(a, b.next) |
| 170 | } |
| 171 | return result |
| 172 | } |
| 173 | |
| 174 | func (enc *encoder) less(i fastJsonNode, j fastJsonNode) bool { |
| 175 | attri := enc.getAttr(i) |
Tested by
no test coverage detected