如何实现位向量(bitset)(在Java中)?
是否有一些好的文本、书籍、pdf 或网站解释如何实现位向量,尤其是在 Java 中?
我问这个问题是因为我想用 Java 实现我自己的 BitSet 实现。原因是我想添加额外的功能和调整,如果我修改 java.util 中的 BitSet Java 类,则无法完成这些功能和调整。此外,我想制作自己的实现,以便我可以在我的开源项目中使用它,而无需处理许可证。
谢谢!
Is there some good text, books, pdf or website that explains how to implement a bit vector, especially in Java?
I ask this question because I would like to make my own BitSet implementation in Java. The reason is that I want to add aditional features and tweak that cannot be done if I modify the BitSet Java class from java.util. Moreover, I want to make my own implementation so that I can use it in my open-source project without having to deal with licenses.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想要位向量或位集具有出色的性能或其他出色的功能,那么正如有人已经建议的那样,您应该继承位向量/位集的现有实现。或者,您可以参考一些开源实现。不过,如果你想了解位向量的机制,那就相当简单了。以下是一个实现示例:
您可以在上面的示例中实现并添加您自己的 set-wise 操作功能。
If you want fancy performance or other fancy features for your bit vector or bit set, then as some one already suggested, you should inherit an existing implementation of bit vector/set. Or, you may refer to some open source implementations. However, if you want to learn the mechanism of bit vector, it is rather simple. Here's an implementation as example:
You may implement and add your own set-wise operation features into the above example.
快速实施您的要求。希望有帮助。
A quick implementation for your requirement. Hope it helps.