-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathMain.java
More file actions
22 lines (14 loc) · 708 Bytes
/
Main.java
File metadata and controls
22 lines (14 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.function.Predicate;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
String value = "shubhanshu";
StringValidator nonEmptyValidator = v-> !v.isEmpty();
StringValidator lengthValidator = v-> v.length()>5;
StringValidator capitalLetterValidator = v->(!v.isEmpty() && Character.isUpperCase(v.charAt(0)));
System.out.println(nonEmptyValidator.validate(value));
System.out.println(lengthValidator.validate(value));
System.out.println(capitalLetterValidator.validate(value));
}
}