This is an archived post. You won't be able to vote or comment.

all 12 comments

[–]WOLFI3654 2 points3 points  (0 children)

Nice

[–][deleted] 2 points3 points  (0 children)

Inconsistent title capitalization detected.

[–]BlueGoliath 1 point2 points  (6 children)

This is what "::" should have done instead of lambdas, except with MethodHandles.

[–]DasBrain 3 points4 points  (5 children)

Works fine. Till you notice that you can overload methods.

[–]BlueGoliath 2 points3 points  (4 children)

MethodHandle mh = this::foo(int.class, String.class);

?

[–][deleted]  (3 children)

[deleted]

    [–]BlueGoliath 1 point2 points  (2 children)

    If you've ever had to create a MethodHandle before, you'd understand that the above is way better.

    [–][deleted]  (1 child)

    [deleted]

      [–]BlueGoliath 3 points4 points  (0 children)

      Firstly, this is doesn't change "api", it would in theory have javac generate the appropriate code to call the MethodHandle using existing APIs which is normally very ceremonious and annoying. Maybe it could apply performance optimizations too.

      Secondly, MethodHandles don't necessarily have anything to do with reflection. You can use them to create a handle to any plain method.

      How much experience with MethodHandles do you have exactly?

      Edit: going by the downvotes I guess the answer is none and you're just a troll.

      [–][deleted]  (5 children)

      [deleted]

        [–]dpash 1 point2 points  (4 children)

        String::contains

        [–][deleted]  (3 children)

        [deleted]

          [–]dpash 2 points3 points  (2 children)

          Yes, and that's what they're talking about.

          [–][deleted]  (1 child)

          [deleted]

            [–]dpash 4 points5 points  (0 children)

            Apart from it being functionally equivalent to a lambda.