NormalizedNodeAggregator should also report empty
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / datastore / utils / MutableUnsignedLongSet.java
index b42a945519b97204352bb1afbd9c0fc34940c110..d225033ebc9b02119cf6e76912666f7a6e174427 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.controller.cluster.datastore.utils;
 import com.google.common.annotations.Beta;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableRangeSet;
+import com.google.common.collect.Range;
 import com.google.common.primitives.UnsignedLong;
 import java.util.NavigableSet;
 import java.util.TreeSet;
@@ -185,7 +186,9 @@ public final class MutableUnsignedLongSet extends UnsignedLongSet implements Mut
         return Entry.of(lowerBits, newUpper);
     }
 
+    // Provides compatibility with RangeSet<UnsignedLong> using [lower, upper + 1)
     public ImmutableRangeSet<UnsignedLong> toRangeSet() {
-        return ImmutableRangeSet.copyOf(Collections2.transform(trustedRanges(), Entry::toUnsigned));
+        return ImmutableRangeSet.copyOf(Collections2.transform(trustedRanges(), entry -> Range.closedOpen(
+            UnsignedLong.fromLongBits(entry.lowerBits), UnsignedLong.fromLongBits(entry.upperBits + 1))));
     }
 }