public void removeSamples(HashSet<String> names){
  final ArrayList<String> samplesclone=new ArrayList<>(mSampleNames);
  for (  final String sampleName : samplesclone) {
    if (names.contains(sampleName)) {
      mSampleNames.remove(sampleName);
    }
  }
  mNameToColumn.clear();
  for (int i=0; i < mSampleNames.size(); i++) {
    mNameToColumn.put(mSampleNames.get(i),i);
  }
  final Iterator<SampleField> iterator=mSampleLines.iterator();
  while (iterator.hasNext()) {
    final SampleField sample=iterator.next();
    if (names.contains(sample.getId())) {
      iterator.remove();
    }
  }
}

public void removeSamples ( HashSet < String > names ) { final ArrayList < String > samplesclone = new ArrayList < > ( mSampleNames ) ; for ( final String sampleName : samplesclone ) { if ( names . contains ( sampleName ) ) { mSampleNames . remove ( sampleName ) ; } } mNameToColumn . clear ( ) ; for ( int i = 0 ; i < mSampleNames . size ( ) ; i ++ ) { mNameToColumn . put ( mSampleNames . get ( i ) , i ) ; } final Iterator < SampleField > iterator = mSampleLines . iterator ( ) ; while ( iterator . hasNext ( ) ) { final SampleField sample = iterator . next ( ) ; if ( names . contains ( sample . getId ( ) ) ) { iterator . remove ( ) ; } } }
remove sample names from this record
