Mercurial > hg > Members > tatsuki > functionaljava-master > core
changeset 4:19c719aba746 default tip
change getLoop return value
author | tatsuki |
---|---|
date | Mon, 20 Apr 2015 08:09:22 +0900 |
parents | 68e5def4e745 |
children | |
files | src/main/java/fj/data/TreeMap.java |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/fj/data/TreeMap.java Sat Mar 21 11:23:09 2015 +0900 +++ b/src/main/java/fj/data/TreeMap.java Mon Apr 20 08:09:22 2015 +0900 @@ -32,7 +32,6 @@ * @return an empty TreeMap with the given key order. */ public static <K, V> TreeMap<K, V> empty(final Ord<K> keyOrd) { - System.out.println("4"); return new TreeMap<K, V>(Set.empty(TreeMap.<K, V>ord(keyOrd))); } @@ -52,10 +51,10 @@ // // // // System.out.println("aaaa"); // // return x.bind(P2.<K, Option<V>>__2()); - return getLoop(k); + return Option.<V>some(getLoop(k)); } - public Option<V> getLoop(final K k) { + public V getLoop(final K k) { Set<P2<K, V>> cur = tree; // Option<V> op = Option.<V>none(); while (!cur.isEmpty()) { @@ -71,11 +70,11 @@ else if (i < 0) cur = cur.r(); else - return Option.<V>some(head._2()); + return head._2(); } - return Option.<V>none(); + return null; // return Option.<V>none(); } @@ -203,7 +202,7 @@ public F<K, Option<V>> get() { return new F<K, Option<V>>() { public Option<V> f(final K k) { - return getLoop(k); + return get(k); } }; }