code: public void apply(List target, List tmp)
      {
          if (target.size() != length())
              throw new RuntimeException("target array does not have the same length as the index table");
          //fill tmp with the original ordering or target, adding when needed
          for (int i = 0; i < target.size(); i++)
              if (i >= tmp.size())
                  tmp.add(target.get(i));
              else
                  tmp.set(i, target.get(i));
          //place back into target from tmp to get sorted order
          for(int i = 0; i < target.size(); i++)
              target.set(i, tmp.get(index(i)));
      }
docs: Applies this index table to the specified target, putting {@code target}
  into the same ordering as this IndexTable. It will use the provided
  {@code tmp} space to store the original values in target in the same
  ordering. It will be modified, and may be expanded using the {@link
  List#add(java.lang.Object) add} method if it does not contain sufficient
  space. Extra size in the tmp list will be ignored. After this method is
  called, {@code tmp} will contain the same ordering that was in
  {@code target} <br>
  <br>
  This method is provided as a means to reducing memory use when multiple
  lists need to be sorted.
  
  @param target the list to sort, that should be the same size as the
  previously sorted list.
  @param tmp the temp list that may be of any size