title: Is there a way to use method references for top-level functions in jshell?
body: <p>Suppose I do this in jshell:</p>
  
  <pre><code>jshell&gt; void printIsEven(int i) {
     ...&gt;     System.out.println(i % 2 == 0);
     ...&gt; }
  |  created method printIsEven(int)
  
  jshell&gt; List&lt;Integer&gt; l = Arrays.asList(7,5,4,8,5,9);
  l ==&gt; [7, 5, 4, 8, 5, 9]
  
  jshell&gt; l.forEach(/* ??? */); // is it possible to use a method reference here?
  </code></pre>
  
  <p>In a normal program I could write <code>l.forEach(this::printIsEven)</code> in a non-static context or <code>l.forEach(MyClass::printIsEven)</code> in the static context of a class named <code>MyClass</code>.</p>
  
  <p>Using <code>this::printIsEven</code> in jshell doesn't work because jshell executes statements in a static context, but you can't use a static method reference because there's no class name to prefix <code>::printIsEven</code>, and trying <code>l.forEach(::printIsEven)</code> is just a syntax error.</p>