I'm struggling with evaluation expression that contains some Stream API methods. Example:
sample.reads.stream().filter(s -> s.l.length() < 10)
This doesn't work as well:
sample.reads.stream().filter(s -> s.l.length() < 10).collect(Collectors.toList())
gives:
However, sample.reads.stream().count()
or sample.reads.stream().toArray()
works fine as well as any other expression(and if I put stream API call into code it also works fine)
Config: Java: jdk1.8.0_144
Idea: IntelliJ IDEA 2017.3.1 (Community Edition) Build #IC-173.3942.27, built on December 11, 2017 JRE: 1.8.0_152-release-1024-b8 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0
UPDATE
Sorry, for confusion. Even terminal commands don't work. I showed this example because I found that examption is thrown on filter method, not on collect. If I add .collect() I'll see the same error
UPDATE 2 I don't think it's something with classes. Even this gives me the same error:
IntStream.range(0, 100).filter(i -> i%2 == 0).toArray()
Evaluate a complex expression in the editor Click Run | Debugging Actions | Quick Evaluate Expression Ctrl+Alt+F8 . Alternatively, hold Alt and click the selection.
Run your application with the debugger ⌃D (macOS), or Shift+F9 on Windows and Linux. Again, you can click the run icon over in the gutter on the left on line 21 if you prefer. On the right-hand side of the debug window, click the button called Trace Current Stream Chain.
Start the IDE, Help | Find Action (Ctrl+Shift+A or Cmd+Shift+A on Mac), type "Switch IDE Boot JDK", press Enter. Start the IDE, use Help | Find Action (Ctrl+Shift+A or Cmd+Shift+A on Mac), type "Switch IDE Boot JDK", press Enter. Switch IDE Boot JDK dialog appears.
You can customize how threads are displayed on the Frames and Threads tabs. It might be helpful when you are working on a multithreaded application and often need to access information about your threads. Right-click anywhere in the Frames or Threads tab and select Customize Threads View.
This is a bit of a guess, but the problem seems to be a classpath related problem. Due to this you get the message that specific packages cannot be found.
I do not think this is due to terminal or non terminal stream operations. Even non terminal operations can be evaluated in IDEA without errors. See this:
I strongly suggest to check the Run/Debug configuration in IDEA and check which classpath is being used for this application. Open the following dialog and check what is in the "Use classpath of module" field:
A wrong value might have sneaked in there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With