default equals again, sorry

Jose jgetino at telefonica.net
Thu Jan 23 20:20:18 PST 2014


I see thanks; I have to replicate the code in each factory. 

On the other way, do you think that this idiom would lead to a fewer
overhead than instantiating (x,y) points?. 

The scenario is a chain of 2D transforms (over an image for example), every
step would require a new pair to be created.

Paul, I want to compare this with a stock implementation, but I don't need
it, I only want a factory to create anonymous classes from the interface.
     


-----Mensaje original-----
De: John Rose [mailto:john.r.rose at oracle.com] 
Enviado el: jueves, 23 de enero de 2014 23:04
Para: Jose
CC: lambda-dev at openjdk.java.net
Asunto: Re: default equals again, sorry

On Jan 23, 2014, at 1:02 PM, "Jose" <jgetino at telefonica.net> wrote:


	interface Point(){
	int x();
	int y();
	static Point of(int x, int y) {
	  return new Point() {
	      public int x() {
	            return x;
	      }
	      public int y() {
	          return y;
	      }
	

+      public boolean equals(Object x) { return defaultEquals(x); }
+      public int hashCode() { return defaultHashCode(); }


	   };
	}
	





More information about the lambda-dev mailing list