如何关闭java流序列中的类型提示

Min*_*iMe 6 java intellij-idea

当我在 Java 中有使用流的代码时,intellij 会显示有关流结果的类型提示。

我想禁用这些提示

使用以下代码的示例:

Stream.of (1, 2. 3)
    .map (n -> n + 1)
    .map (n -> n % 2 == 0 ? "even number " + n : "odd number " + n)
    .peek (System.out:println)
    .map (s -> Float.parseFloat (s.substring (s.lastIndexOf (" "))))
    ;
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

我已经关闭了其他参数的工具提示,但流后的提示仍然存在。它们在视觉上非常分散我的注意力,同时为我提供很少的额外信息。

如果我知道如何更改提示的颜色或样式,我也会很高兴(我安装了 Material Theme UI)

ceg*_*gas 5

IntelliJ 2019.2 CE

  1. Navigate to: Preferences -> Editor -> Inlay Hints -> Java. Alternatively, press CMD (?)/Ctrl + Shift + A, search for Inlay Hints, open the first result, and select Java.
  2. Untick Method Chains tickbox

在此处输入图片说明

Alternatively, you can increase the count of unique types in streams/method chains from which the type hints will be shown. I.e., if your stream transforms from type A to type B, and then to type C, this would be 3 types. If you set it to 2, hints would be shown for 3 unique types and more.