Class TopologyHelper

java.lang.Object
com.couchbase.client.core.topology.TopologyHelper

@Internal public class TopologyHelper extends Object
  • Method Details

    • compressKeyRuns

      public static <V> LinkedHashMap<String,V> compressKeyRuns(Map<Integer,V> map)
      Returns new map derived by merging contiguous keys that have the same value. Key ranges are expressed as: START_INCLUSIVE..END_INCLUSIVE

      For example:

       Given:   {0=A, 1=A, 3=A, 4=B, 5=A}
       Returns: {0..1=A, 3=A, 4=B, 5=A}
       
      Throws:
      NullPointerException - if map is null or contains a null key