View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;
2   
3   import java.util.stream.Collectors;
4   import java.util.stream.Stream;
5   
6   public class InputRightCurlyAloneLambda {
7   
8       static Runnable r1 = () -> {
9           String.valueOf("Test rightCurly one!");
10      };
11  
12      static Runnable r2 = () -> String.valueOf("Test rightCurly two!");
13  
14      static Runnable r3 = () -> {String.valueOf("Test rightCurly three!");};   //violation
15  
16      static Runnable r4 = () -> {
17          String.valueOf("Test rightCurly four!");};    //violation
18  
19      static Runnable r5 = () ->
20      {
21          String.valueOf("Test rightCurly five!");
22      };
23  
24      static Runnable r6 = () -> {};
25  
26      static Runnable r7 = () -> {
27      };
28  
29      static Runnable r8 = () ->
30      {
31      };
32  
33      static Runnable r9 = () -> {
34          String.valueOf("Test rightCurly nine!");
35      }; int i;       // violation
36  
37      void foo1() {
38          Stream.of("Hello").filter(s -> {
39                  return s != null;
40              }
41          ).collect(Collectors.toList());
42  
43          Stream.of("Hello").filter(s -> {
44                  return s != null;
45          }).collect(Collectors.toList());    // violation
46      }
47  }