Remove reliance on deprecated classes in BGP components
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPObjectComparator.java
index 0be37b9fbe4073848f0813b59a8c6837455b1004..767009bfecb2214597a3addf4d4e8f0c3dd727cf 100644 (file)
@@ -11,7 +11,6 @@ import java.util.Comparator;
 
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130918.PathAttributes;
 
-
 /**
  * This comparator is intended to implement BGP Best Path Selection algorithm, as described at
  * 
@@ -20,17 +19,22 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
  * @param <T> Actual object state reference
  */
 final class BGPObjectComparator implements Comparator<PathAttributes> {
+       public static final BGPObjectComparator INSTANCE = new BGPObjectComparator();
+
+       private BGPObjectComparator() {
+       }
+
        @Override
        public int compare(final PathAttributes o1, final PathAttributes o2) {
-               if (o1 == o2) {
-                       return 0;
-               }
                if (o1 == null) {
                        return 1;
                }
                if (o2 == null) {
                        return -1;
                }
+               if (o1.equals(o2)) {
+                       return 0;
+               }
 
                // FIXME: look at ASPath
                // FIXME: look at everything else :-)