/**
  * Creates a new consistent hash instance based on the type specified, and populates the
  * consistent hash with the collection of addresses passed in.
  *
  * @param template An older consistent hash instance to clone
  * @param addresses with which to populate the consistent hash
  * @return a new consistent hash instance
  */
 public static ConsistentHash createConsistentHash(
     ConsistentHash template, Collection<Address> addresses) {
   Hash hf = null;
   HashSeed hs = null;
   int numVirtualNodes = 1;
   GroupManager groupManager = null;
   if (template instanceof AbstractWheelConsistentHash) {
     AbstractWheelConsistentHash wTemplate = (AbstractWheelConsistentHash) template;
     hf = wTemplate.hashFunction;
     hs = wTemplate.hashSeed;
     numVirtualNodes = wTemplate.numVirtualNodes;
     groupManager = wTemplate.groupManager;
   }
   ConsistentHash ch =
       constructConsistentHashInstance(template.getClass(), hf, hs, numVirtualNodes, groupManager);
   if (addresses != null && !addresses.isEmpty()) ch.setCaches(toSet(addresses));
   return ch;
 }