public static LinkedList<String> wrapInTag(LinkedList<String> sequence,int startPosition,int endPosition,String tag,String cssClass){
  LinkedList<String> result=(LinkedList<String>)sequence.clone();
  StringBuilder tagBuilder=new StringBuilder();
  tagBuilder.append("<");
  tagBuilder.append(tag);
  if (cssClass != null) {
    tagBuilder.append(" class=\"");
    tagBuilder.append(cssClass);
    tagBuilder.append("\"");
  }
  tagBuilder.append(">");
  String startTag=tagBuilder.toString();
  tagBuilder.delete(0,tagBuilder.length());
  tagBuilder.append("</");
  tagBuilder.append(tag);
  tagBuilder.append(">");
  String endTag=tagBuilder.toString();
  result.add(startPosition,startTag);
  result.add(endPosition,endTag);
  return result;
}

public static LinkedList < String > wrapInTag ( LinkedList < String > sequence , int startPosition , int endPosition , String tag , String cssClass ) { LinkedList < String > result = ( LinkedList < String > ) sequence . clone ( ) ; StringBuilder tagBuilder = new StringBuilder ( ) ; tagBuilder . append ( "<" ) ; tagBuilder . append ( tag ) ; if ( cssClass != null ) { tagBuilder . append ( " class=\"" ) ; tagBuilder . append ( cssClass ) ; tagBuilder . append ( "\"" ) ; } tagBuilder . append ( ">" ) ; String startTag = tagBuilder . toString ( ) ; tagBuilder . delete ( 0 , tagBuilder . length ( ) ) ; tagBuilder . append ( "</" ) ; tagBuilder . append ( tag ) ; tagBuilder . append ( ">" ) ; String endTag = tagBuilder . toString ( ) ; result . add ( startPosition , startTag ) ; result . add ( endPosition , endTag ) ; return result ; }
wrap the elements in the sequence with the given tag
