开发者

Are TreeSet.floor() and TreeSet.ceiling() methods missing in Android?

this one is a deep mystery to me.

Take a look at this:

TreeSet<Long> s = new TreeSet<Long>();
s.add(Long.valueOf(1));
s.add(Long.valueOf(4));
s.add(Long.valueOf(6));
s.add(Long.valueOf(9));

Long upper = s.ceiling(Long.valueOf(5));
Long lower = s.floor(Long.valueOf(5));

In a normal Java VM, this compiles and runs beautifully.

If I take a look at Android's API doc, and even according to: http://www.java2s.com/Open-Source/Android/android-core/platform-libcore/java/util/TreeSet.java.htm

the methods ceiling and floor should be there.

Bu开发者_运维百科t if I try to use them in Eclipse + Android SDK (Build Target is "8"), Eclipse is telling me that floor(Long) and ceiling(Long) are not defined for class TreeSet

Any idea?

Thanks, Karlheinz


floor is API level 9, same goes for ceiling.

Android javadoc for TreeSet


In a normal Java VM, this compiles and runs beautifully.

Not in my JVM (which is 1.5.0_22). There I have headSet(...) and tailSet(...).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜