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

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

问题描述

我想为 xor-linked list 编写 java 代码.有人可以建议我如何在引用之间执行异或运算吗?

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

推荐答案

长话短说,你不能.

再多说一点,如果 Java 允许您通过引用传递变量,那么 Java 语言不允许对这些引用进行算术运算.因此,您的异或操作将无法进行.

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.

此外,在阅读维基百科条目时,我理解这是经典链表实现的内存优化,依赖于确定下一个/上一个节点,仅依赖于该指针算法.我认为这是一种非常高级的内存优化,它在 Java 中似乎不如在非托管内存语言(例如 C(++) 中)有用.

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

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

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