(String[] args)
| 142 | |
| 143 | // Main method demonstrating usage |
| 144 | public static void main(String[] args) { |
| 145 | var example = new Builder() |
| 146 | .name("Test Example") |
| 147 | .build(); |
| 148 | |
| 149 | // Lambda and method reference usage |
| 150 | List<String> items = Arrays.asList("a", "b", "c"); |
| 151 | example.processItems( |
| 152 | items, |
| 153 | String::isEmpty, |
| 154 | System.out::println |
| 155 | ); |
| 156 | |
| 157 | // Stream API usage |
| 158 | Map<Status, Long> statusCounts = items.stream() |
| 159 | .map(s -> Status.PENDING) |
| 160 | .collect(Collectors.groupingBy( |
| 161 | status -> status, |
| 162 | Collectors.counting() |
| 163 | )); |
| 164 | |
| 165 | // CompletableFuture with exception handling |
| 166 | example.processAsync("test") |
| 167 | .thenApply(String::toLowerCase) |
| 168 | .exceptionally(throwable -> { |
| 169 | System.err.println("Error: " + throwable.getMessage()); |
| 170 | return ""; |
| 171 | }); |
| 172 | |
| 173 | // Try-with-resources and Optional usage |
| 174 | try (var scanner = new Scanner(System.in)) { |
| 175 | Optional.of(scanner.nextLine()) |
| 176 | .filter(example::validate) |
| 177 | .ifPresent(example::processAsync); |
| 178 | } |
| 179 | } |
| 180 | } |
nothing calls this directly
no test coverage detected