简体   繁体   English

此Bits类与Bitset之间的区别

[英]Difference between this Bits class and Bitset

I have a question on the differences between the Bits class from the LibGDX library and the BitSet class in the standard Java library. 我对LibGDX库中的Bits类与标准Java库中的BitSet类之间的区别有疑问。 Was the Bits class built to be faster in handling bitwise operations or more memory efficient? 是建立Bits类以更快地处理按位运算还是提高内存效率?

I believe this is the source of that class. 我相信是该课程的源头。 Here's the source of BitSet . 这是BitSet的来源。 At a glance they're very similar; 乍一看,它们非常相似; they're both backed by long[] s. 他们都得到long[]的支持。 I would not expect any particular improvement in performance. 我不希望性能有任何特别的提高。 You can use whichever you'd prefer, though I'd err on the side of the JDK implementation as more standard. 可以使用任何您喜欢的方式,尽管我更倾向于将JDK实现作为标准。

It's somewhat odd that the class doesn't even mention the JDK's BitSet (such as a "This class performs better/worse than BitSet in such-and-such case") which makes me wonder if the implementors simply didn't look for such a class in the JDK before creating theirs. 奇怪的是,该类甚至没有提到JDK的BitSet (例如“此类实例在这种情况下比BitSet更好/更差”),这使我想知道实现者是否根本没有在寻找此类东西。创建它们之前,在JDK中创建一个类。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM