View Javadoc
1   /*
2   LambdaParameterName
3   format = ^(id)|([a-z][a-z0-9][a-zA-Z0-9]+)$
4   
5   
6   */
7   
8   package com.puppycrawl.tools.checkstyle.checks.naming.lambdaparametername;
9   
10  import java.util.function.BiFunction;
11  import java.util.function.Function;
12  
13  public class InputLambdaParameterName {
14  
15      Function<String, String> badNamedParameterWithoutParenthesis = s -> // violation 'must match'
16              s.trim().toLowerCase();
17  
18      Function<String, String> badNamedParameterWithParenthesis = (st) -> // violation 'must match'
19              st.trim().toLowerCase();
20  
21      BiFunction<String, String, String> twoBadNamedParameters = (s1, // violation 'must match'
22                                                                  s2) -> s1 + s2;
23      // violation above 'Name 's2' must match pattern'
24  
25      BiFunction<String, String, String> badNamedParameterInBiFunction =
26              (first, s) -> first + s; // violation 'must match'
27  
28      Function<String, Integer> goodNamedParameterWithoutParenthesis =
29              notTrimmedString -> notTrimmedString.trim().length();
30  
31      Function<String, Integer> goodNamedParameterWithParenthesis =
32              (notTrimmedString) -> notTrimmedString.trim().length();
33  
34      BiFunction<String, String, Integer> goodNamedParameters =
35              (first, second) -> (first + second).length();
36  
37  }