code: public final VariableNumMap getVariablesByName(Collection<String> variableNames) {
      int[] newNums = new int[nums.length];
      String[] newNames = new String[nums.length];
      Variable[] newVars = new Variable[nums.length];
  
      int numFilled = 0;
      for (int i = 0; i < nums.length; i++) {
        if (variableNames.contains(names[i])) {
          newNums[numFilled] = nums[i];
          newNames[numFilled] = names[i];
          newVars[numFilled] = vars[i];
          numFilled++;
        }
      }
      return VariableNumMap.fromSortedArrays(newNums, newNames, newVars, numFilled);
    }
docs: Gets the subset of {@code this} containing variables with a name
  in {@code variableNames}. Names in {@code variableNames} which
  are not in {@code this} are ignored.
  
  @param variableNames
  @return