<代码>等于(object)方法的合同具体规定了以下4种特性:重修、校对、中转和一致性。 虽然我理解不服从依赖性、不对称性和一致性的危险,而且能够肯定地同意其服从于过境的好处,但我还是想知道,如果它侵犯过境财产,会带来什么损害?
具体来说, Java图书馆(或各种第三方图书馆)中哪些需要依赖<条码>平等条码>才能进行正确工作? 我的理解是,如果其他3种财产得到妥善执行,则收集框架将发挥作用。
<代码>等于(object)方法的合同具体规定了以下4种特性:重修、校对、中转和一致性。 虽然我理解不服从依赖性、不对称性和一致性的危险,而且能够肯定地同意其服从于过境的好处,但我还是想知道,如果它侵犯过境财产,会带来什么损害?
具体来说, Java图书馆(或各种第三方图书馆)中哪些需要依赖<条码>平等条码>才能进行正确工作? 我的理解是,如果其他3种财产得到妥善执行,则收集框架将发挥作用。
a、b、c
a == a, b == b, c == c (reflexive)
a == b, b == a
b == c, c == b
a != c, c != a
(Pseudocode,x = y <>code>x.qualitys(y)
。
现在请在一组物体中添加:
Set s = new HashSet(); // Set implementation doesn t matter
s.add(b); // s = [b]
s.add(a); // s doesn t change, because a == b
s.add(c); // s doesn t change, because c == b
相比之下,如果要以不同顺序增加:
Set s = new HashSet();
s.add(a); // s = [a]
s.add(b); // s doesn t change, because b == a
s.add(c); // s = [a,c], because c != a
That is clearly counter-intuitive and doesn t match the behavior one would expect of a set. For example, it would mean that the union of two sets (i.e. the state of s after s.addAll(someOtherSet)
) could depend on the implementation (order of elements) of someOtherSet.
此时,我不知道有没有过境能力的问题。 (我仍在举一个例子。)
但是,除了这一点外,平等需要过境,因为平等关系是数学的图书馆定义。 。
如果过境不在场,则不能将这种方法称为平等,因为考虑到在听取/阅读“平等”时人们的期望,这样做会造成误导。 这与以下原则相矛盾:http://en.wikipedia.org/wiki/Principle_of_least_astonishment”rel=“nofollow” http://en.wikipedia.org/wiki/Principle_of_least_astonishment 。
<><>>
与此相关的有趣之处是,严格说出“平等”一词是“平等”,而不是“平等”,而是“横向平等”关系:。 由于不同的物体也可按照java被“平等”,从而与真正的平等所需的反金属财产相矛盾。
http://www.hchr.org。
Java的不平等是一种等同关系(仍需要过境)。
= Java是平等(或身份)关系
考虑目标a=b=c, != c(非过境平等)
第一个问题是 has码(hcode)合同,要求 has形码在物体平等时平等。 并且,你将能够在同一组别中增加一个和c项——这可能导致在意外地点出现微妙的问题。
Integer a = new Integer(1);
Integer b = new Integer(1);
a = 1
是真实的,b = 1
是真实的,但a = b
不是真实的。
Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...
Check this, List<String> list = new ArrayList<String>(); for (int i = 0; i < 10000; i++) { String value = (""+UUID.randomUUID().getLeastSignificantBits()).substring(3, ...
I am in the middle of solving a problem where I think it s best suited for a decorator and a state pattern. The high level setting is something like a sandwich maker and dispenser, where I have a set ...
I have been trying to execute a MS SQL Server stored procedure via JDBC today and have been unsuccessful thus far. The stored procedure has 1 input and 1 output parameter. With every combination I ...
I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...
If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...
I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....
I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...