From 1888868624901c2934b3a073b1c0525b932ded6f Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Mon, 16 Dec 2024 16:59:17 -0800 Subject: [PATCH] Use statement lambda where possible --- .../plugins/ec2/util/AmazonEC2FactoryMockImpl.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/test/java/hudson/plugins/ec2/util/AmazonEC2FactoryMockImpl.java b/src/test/java/hudson/plugins/ec2/util/AmazonEC2FactoryMockImpl.java index ab8e715fd..6b1b7f7e1 100644 --- a/src/test/java/hudson/plugins/ec2/util/AmazonEC2FactoryMockImpl.java +++ b/src/test/java/hudson/plugins/ec2/util/AmazonEC2FactoryMockImpl.java @@ -214,12 +214,10 @@ private static void mockTerminateInstances(AmazonEC2Client mock) { Mockito.doAnswer(invocationOnMock -> { TerminateInstancesRequest request = invocationOnMock.getArgument(0); List instancesToRemove = new ArrayList<>(); - request.getInstanceIds().forEach(instanceId -> { - instances.stream() - .filter(instance -> instance.getInstanceId().equals(instanceId)) - .findFirst() - .ifPresent(instancesToRemove::add); - }); + request.getInstanceIds().forEach(instanceId -> instances.stream() + .filter(instance -> instance.getInstanceId().equals(instanceId)) + .findFirst() + .ifPresent(instancesToRemove::add)); instances.removeAll(instancesToRemove); return new TerminateInstancesResult() .withTerminatingInstances(instancesToRemove.stream()