View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="LambdaParameterName">
5         <property name="format" value="^[a-z]([a-zA-Z]+)*$"/>
6       </module>
7     </module>
8   </module>
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.naming.lambdaparametername;
12  
13  import java.util.function.Function;
14  
15  import java.util.stream.Stream;
16  
17  // xdoc section -- start
18  class Example2 {
19    Function<String, String> function1 = str -> str.toUpperCase().trim();
20    Function<String, String> function2 = _s -> _s.trim();
21    // violation above 'Name '_s' must match pattern'
22  
23    public boolean myMethod(String sentence) {
24      return Stream.of(sentence.split(" "))
25              .map(word -> word.trim())
26              .anyMatch(Word -> "in".equals(Word));
27      // violation above 'Name 'Word' must match pattern'
28    }
29  }
30  // xdoc section -- end