code: public Map<Integer, Integer> updateBuckets(Map<Integer, Integer> oldBuckets, List<Integer> members) {
          if (isEmpty(members)) {
              throw new IllegalArgumentException("newMembers must be not null");
          }
          /*
              Create a new map
           */
          if (isEmpty(oldBuckets)) {
              Map<Integer, Integer> newBuckets = new HashMap<>();
              for (int i = 0; i < members.size(); i++) {
                  newBuckets.put(i, members.get(i));
              }
              return newBuckets;
          }
  
          Map<Integer, Integer> newBuckets = new HashMap<>();
          int newBucket = 0;
          while (newBucket < members.size()) {
              int bucket = 0;
              boolean placed = false;
              while (bucket < oldBuckets.size() && !placed) {
                  Integer oldMember = oldBuckets.get(bucket);
                  if (!newBuckets.containsValue(oldMember)
                          && members.contains(oldMember)
                          && (bucket == newBucket || bucket >= members.size())) {
                      newBuckets.put(newBucket, oldMember);
                      placed = true;
                  } else {
                      bucket++;
                  }
              }
              if (bucket == oldBuckets.size() && !placed) {
                  newBuckets.put(newBucket, members.get(newBucket));
              }
              newBucket++;
          }
          return newBuckets;
      }
docs: Update a nodes table.
  This table is represented as a Map<Integer, Integer> where:
  - key is an index within [0, n-1] being n the number of nodes.
  - value is the code that represents a node, it is calculated from Address.hashCode
  
  This method re-calculate a new table from an old table and with a new list with new members.
  The algorithm minimizes the changes across topology changes.
  
  @param oldBuckets the old table used as input for the calculation
  @param members a new list of members
  @return a new table of nodes