Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8206137

Shorter notation for method references

    Details

      Description

      A DESCRIPTION OF THE PROBLEM :
      Sometimes, the notation of function pointers is a bit bloated and could be done shorter.

      Example:

      public <T> String doIt(T t, Function<T, String> f);

      Call:
      doIt(myObject, MyClassWithLongName::getProp);

      Since the class is absolutely clear here or could at least be assumed to be MyClassWithLongName, if myObject is of that type, the notation could be as short as:

      doIt( myObject, ::getProp);

      This could make calls to utility methods, that should make a call shorter, even better.


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: