Sho SHIMIZU

Refactor: use ifPresent() instead of isPresent()

Change-Id: I41d6cbf7ba209728ae7e3661e7188ab8eab093e4
1 /* 1 /*
2 - * Copyright 2015 Open Networking Laboratory 2 + * Copyright 2015-2016 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -59,15 +59,13 @@ public interface IntentProcessPhase { ...@@ -59,15 +59,13 @@ public interface IntentProcessPhase {
59 } 59 }
60 60
61 static void transferErrorCount(IntentData data, Optional<IntentData> stored) { 61 static void transferErrorCount(IntentData data, Optional<IntentData> stored) {
62 - if (stored.isPresent()) { 62 + stored.ifPresent(storedData -> {
63 - IntentData storedData = stored.get();
64 if (Objects.equals(data.intent(), storedData.intent()) && 63 if (Objects.equals(data.intent(), storedData.intent()) &&
65 Objects.equals(data.request(), storedData.request())) { 64 Objects.equals(data.request(), storedData.request())) {
66 data.setErrorCount(storedData.errorCount()); 65 data.setErrorCount(storedData.errorCount());
67 } else { 66 } else {
68 data.setErrorCount(0); 67 data.setErrorCount(0);
69 } 68 }
70 - } 69 + });
71 } 70 }
72 -
73 } 71 }
......