summaryrefslogtreecommitdiffstats
path: root/policy-utils/src
diff options
context:
space:
mode:
Diffstat (limited to 'policy-utils/src')
-rw-r--r--policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java40
-rw-r--r--policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java4
2 files changed, 15 insertions, 29 deletions
diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java
index 99c4566a..d0b451f1 100644
--- a/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java
+++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedServiceImpl.java
@@ -1,8 +1,8 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* policy-utils
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,6 @@
package org.onap.policy.drools.utils;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -98,30 +97,17 @@ public class OrderedServiceImpl<T extends OrderedService>
// Sort the list according to sequence number, and then alphabetically
// according to full class name.
- Collections.sort(tmp, new Comparator<T>()
- {
- @Override
- public int compare(T o1, T o2)
- {
- int s1 = o1.getSequenceNumber();
- int s2 = o2.getSequenceNumber();
- int rval;
- if (s1 < s2)
- {
- rval = -1;
- }
- else if (s1 > s2)
- {
- rval = 1;
- }
- else
- {
- rval = o1.getClass().getName().compareTo
- (o2.getClass().getName());
- }
- return rval;
- }
- });
+ Collections.sort(tmp, (o1, o2) -> {
+ int s1 = o1.getSequenceNumber();
+ int s2 = o2.getSequenceNumber();
+ if (s1 < s2) {
+ return -1;
+ } else if (s1 > s2) {
+ return 1;
+ } else {
+ return o1.getClass().getName().compareTo(o2.getClass().getName());
+ }
+ });
// create an unmodifiable version of this list
implementers = Collections.unmodifiableList(tmp);
diff --git a/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java b/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java
index cdb93e8a..ff613938 100644
--- a/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java
+++ b/policy-utils/src/test/java/org/onap/policy/drools/utils/TripleTest.java
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
@@ -28,7 +28,7 @@ public class TripleTest {
@Test
public void test() {
Triple<String, String, String> triple =
- new Triple("one", "two", "three");
+ new Triple<>("one", "two", "three");
Assert.assertTrue("one".equals(triple.first()));
Assert.assertTrue("one".equals(triple.getFirst()));