private int[] parseMetaDataInformation() throws UserError {
  int[] selectedColumns=new int[metaData.size()];
  Set<String> usedColumnNames=new HashSet<>();
  int columnIndex=0;
  int usedColumnIndex=0;
  for (  ColumnMetaData column : metaData) {
    if (!column.isRemoved()) {
      selectedColumns[usedColumnIndex]=columnIndex;
      usedColumnIndex++;
      String columnName=column.getName();
      if (!usedColumnNames.contains(columnName)) {
        usedColumnNames.add(columnName);
      }
 else {
        throw new UserError(null,"data_import.non_unique_column_name",columnName);
      }
    }
    columnIndex++;
  }
  int[] attributeColumns=Arrays.copyOf(selectedColumns,usedColumnIndex);
  return attributeColumns;
}

private int [ ] parseMetaDataInformation ( ) throws UserError { int [ ] selectedColumns = new int [ metaData . size ( ) ] ; Set < String > usedColumnNames = new HashSet < > ( ) ; int columnIndex = 0 ; int usedColumnIndex = 0 ; for ( ColumnMetaData column : metaData ) { if ( ! column . isRemoved ( ) ) { selectedColumns [ usedColumnIndex ] = columnIndex ; usedColumnIndex ++ ; String columnName = column . getName ( ) ; if ( ! usedColumnNames . contains ( columnName ) ) { usedColumnNames . add ( columnName ) ; } else { throw new UserError ( null , "data_import.non_unique_column_name" , columnName ) ; } } columnIndex ++ ; } int [ ] attributeColumns = Arrays . copyOf ( selectedColumns , usedColumnIndex ) ; return attributeColumns ; }
goes once through the metadata , checks which columns are removed and checks that the remaining columns have unique names .
