code: public static <V> Object[] build(Iterable<V> source, int size, Comparator<V> comparator, boolean sorted, UpdateFunction<V> updateF)
      {
          if (size < FAN_FACTOR)
          {
              // pad to even length to match contract that all leaf nodes are even
              V[] values = (V[]) new Object[size + (size & 1)];
              {
                  int i = 0;
                  for (V v : source)
                      values[i++] = v;
              }
  
              // inline sorting since we're already calling toArray
              if (!sorted)
                  Arrays.sort(values, 0, size, comparator);
  
              // if updateF is specified
              if (updateF != null)
              {
                  for (int i = 0 ; i < size ; i++)
                      values[i] = updateF.apply(values[i]);
                  updateF.allocated(ObjectSizes.sizeOfArray(values));
              }
              return values;
          }
  
          if (!sorted)
              source = sorted(source, comparator, size);
  
          Queue<Builder> queue = modifier.get();
          Builder builder = queue.poll();
          if (builder == null)
              builder = new Builder();
          Object[] btree = builder.build(source, updateF, size);
          queue.add(builder);
          return btree;
      }
docs: Creates a BTree containing all of the objects in the provided collection
  
  @param source     the items to build the tree with
  @param comparator the comparator that defines the ordering over the items in the tree
  @param sorted     if false, the collection will be copied and sorted to facilitate construction
  @param <V>
  @return