code: public ScanWriter createScanWriter(final int taskId, Set<ScanDestination> destinations) {
          checkArgument(!destinations.isEmpty(), "destinations.isEmpty()");
  
          if (destinations.size() == 1) {
              return createScanWriter(taskId, Iterables.getOnlyElement(destinations));
          }
          return new MultiScanWriter(ImmutableList.copyOf(
                  Iterables.transform(destinations, new Function<ScanDestination, ScanWriter>() {
                      @Override
                      public ScanWriter apply(ScanDestination destination) {
                          return createScanWriter(taskId, destination);
                      }
                  })
          ));
      }
docs: Creates a scan writer from the given desintations.