1,525 reputation
1517
bio website stuartmarks.wordpress.com
location California
age
visits member for 1 year, 9 months
seen 2 days ago

Java and OpenJDK developer, Oracle Corporation.


Mar
8
comment Type inference in Java 8
I don't know enough about .NET to say whether its delegates are similar to Java's functional interfaces. There are some similarities with Linq, but again I don't know enough about Linq to comment on the details. Functional interfaces have a single abstract method (they can have many default methods) and yes, a reference to an object that implements a functional interface is kind of like an O-O function pointer. (This is sometimes called a "functor".)
Nov
6
awarded  Populist
Aug
5
answered Which child process will inherit threads of parent process?
Jul
15
revised java8 wiki excerpt
Copied from Stackoverflow java-8 tag (maybe the tag here on Programmers should be java-8 instead of java8).
Jul
15
revised java8 wiki description
Copied from Stackoverflow java-8 tag (maybe the tag here on Programmers should be java-8 instead of java8).
Jul
15
suggested suggested edit on java8 tag wiki
Jul
15
suggested suggested edit on java8 tag wiki excerpt
Jul
13
awarded  Yearling
Jul
12
awarded  Nice Answer
Apr
17
comment Is a lambda expression something more than an anonymous inner class with a single method?
See also my answer that addresses the syntactic sugar question, though it's an answer to a different question: programmers.stackexchange.com/a/181743/59134
Apr
17
comment Is a lambda expression something more than an anonymous inner class with a single method?
What you said is incorrect. The semantics of lambda and anon inner classes are not exactly the same (though they are similar). Off the top of my head, the meaning of meaning of this changes; and anon inner classes always result in a new instance of an object, whereas a lambda might or might not.
Mar
8
awarded  Nice Answer
Mar
7
wiki created java8 description
Mar
7
wiki created java8 excerpt
Jan
8
comment Type inference in Java 8
(... continued) Given that the signature of compare is int compare(T o1, T o2) and T is MyClass it follows that a and b are of type MyClass. Actually it's a bit more complicated since the target type parameter is ? super MyClass. I'm not sure how we get from here to just MyClass. The inference algorithm might just take the bound of the wildcard. Finally, it then checks that the expression a.order - b.order works with MyClass and the target return type of int. It checks out, so we're done. All this is reasoning mostly within the current type system.
Jan
8
comment Type inference in Java 8
@Giorgio: re inference, actually it's Ratchet Freak's example. It calls Collections.<MyClass>sort but in fact this isn't necessary. One could call Collections.sort(list, ...) and this would work, assuming that list is of type List<MyClass>. Thus, the type arg T must be MyClass and the second arg must be of type Comparator<? super MyClass>. This much inference was in 7. In 8, the second arg's type is now considered to be the target type that is used in inferring the type of the lambda expression. The compare method is the only abstract method on Comparator. (continued...)
Jan
8
comment Type inference in Java 8
@Giorgio: regarding why lambda isn't just syntactic sugar for anonymous inner classes, turns out there was a large discussion about this. This mail from Brian Goetz summarizes the decision: mail.openjdk.java.net/pipermail/lambda-dev/2011-August/… . TL;DR it leaves the door open for future evolution and we get better performance today. Goetz is actually answering a related question, Are lambdas objects? But if the answer is No or even Maybe that implies they cannot be sugar for inner classes.
Jan
7
awarded  Revival
Jan
7
revised Type inference in Java 8
edited tags
Jan
7
answered Type inference in Java 8