Skip to content

Commit 62b202f

Browse files
committed
fix performance and StackOverflowError issue in TreeMap.update()
1 parent 01aef1b commit 62b202f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

core/src/main/java/fj/data/TreeMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ public F<K, Option<V>> get() {
216216
*/
217217
public P2<Boolean, TreeMap<K, V>> update(final K k, final F<V, V> f) {
218218
final P2<Boolean, Set<P2<K, Option<V>>>> up =
219-
tree.update(p(k, Option.<V>none()), P2.<K, Option<V>, Option<V>>map2_(Option.<V, V>map().f(f)));
219+
tree.update(p(k, Option.<V>none()), compose(P2.tuple(P.p2()), P2.<K, Option<V>, Option<V>>map2_(Option.<V, V>map().f(f))));
220220
return P.p(up._1(), new TreeMap<K, V>(up._2()));
221221
}
222222

0 commit comments

Comments
 (0)