public SampleAttributeTable mergeSamples(Collection<String> samples,String newName){
  SampleAttributeTable sampleAttributeTable=new SampleAttributeTable();
  Map<String,Object> attribute2value=new HashMap<>();
  for (  String attribute : getAttributeSet()) {
    boolean valueMismatch=false;
    Object previousValue=null;
    for (    String sample : samples) {
      Object value=table.get(sample,attribute);
      if (value != null) {
        if (previousValue == null)         previousValue=value;
 else         if (!value.equals(previousValue)) {
          valueMismatch=true;
          break;
        }
      }
    }
    if (!valueMismatch && previousValue != null) {
      attribute2value.put(attribute,previousValue);
    }
  }
  sampleAttributeTable.addSample(newName,attribute2value,true,true);
  return sampleAttributeTable;
}

public SampleAttributeTable mergeSamples ( Collection < String > samples , String newName ) { SampleAttributeTable sampleAttributeTable = new SampleAttributeTable ( ) ; Map < String , Object > attribute2value = new HashMap < > ( ) ; for ( String attribute : getAttributeSet ( ) ) { boolean valueMismatch = false ; Object previousValue = null ; for ( String sample : samples ) { Object value = table . get ( sample , attribute ) ; if ( value != null ) { if ( previousValue == null ) previousValue = value ; else if ( ! value . equals ( previousValue ) ) { valueMismatch = true ; break ; } } } if ( ! valueMismatch && previousValue != null ) { attribute2value . put ( attribute , previousValue ) ; } } sampleAttributeTable . addSample ( newName , attribute2value , true , true ) ; return sampleAttributeTable ; }
merges a set of samples and produces a new sample
