public TextCharacter withModifiers(Collection<SGR> modifiers){
  EnumSet<SGR> newSet=EnumSet.copyOf(modifiers);
  if (modifiers.equals(newSet)) {
    return this;
  }
  return new TextCharacter(character,foregroundColor,backgroundColor,newSet);
}

public TextCharacter withModifiers ( Collection < SGR > modifiers ) { EnumSet < SGR > newSet = EnumSet . copyOf ( modifiers ) ; if ( modifiers . equals ( newSet ) ) { return this ; } return new TextCharacter ( character , foregroundColor , backgroundColor , newSet ) ; }
returns a copy of this textcharacter with specified list of sgr modifiers . none of the currently active sgr codes will be carried over to the copy , only those in the passed in value .
