java引用之间的xor操作 [英] xor operation between java references

查看:122
本文介绍了java引用之间的xor操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为 xor-linked list 编写java代码。有人可以建议我如何在引用之间执行xor操作吗?

I want to write java code for xor-linked list . Can somebody suggest me how to perform xor operation between references?

推荐答案

说长话短,你不能

如果Java允许您通过引用传递变量,那么Java语言不允许对这些引用进行算术运算。因此,你的xor操作是不可能的。

With just a little more words, if Java allows you to pass variables by references, arithmetic on these reference is not permitted by the Java language. Hence, your xor operations won't be possible.

此外,在阅读wikiedpia条目时,我认为它是依赖于经典链表实现的内存优化,用于确定下一步/ previous节点,仅依赖于指针算术。我认为它是一种非常先进的内存优化方法,在Java中看起来并不像在非托管内存语言中那样有用,例如C(++)。

Moreover, when reading the wikiedpia entry, I undestand it's a memory optimization of classical linked list implementation relying, for determining next/previous node, solely upon that pointer arithmetics. I consider it a knind of very advanced memory optimization, that don't seem as useful in Java as it can be in unmanaged memory languages like, say, C(++).

这篇关于java引用之间的xor操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆