code: private static List<Short> partitionsForVbids(int numPartitions, Short... vbids) {
      if (vbids.length > 0) {
        Arrays.sort(vbids);
        return Arrays.asList(vbids);
      }
  
      List<Short> partitions = new ArrayList<>(vbids.length);
      for (short i = 0; i < numPartitions; i++) {
        partitions.add(i);
      }
      return partitions;
    }
docs: Helper method to turn the array of vbids into a list.
  
  @param numPartitions the number of partitions on the cluster as a fallback.
  @param vbids the potentially empty array of selected vbids.
  @return a sorted list of partitions to use.