@Override public void endStartTag() throws IOException { if(otherAttributes.isEmpty()) { if(len!=0) { // sort is expensive even for size 0 array, // so it's worth checking len==0 if(!namedAttributesAreOrdered) Arrays.sort(staticAttributes,0,len); // this is the common case for( int i=0; i<len; i++ ) staticAttributes[i].write(); len = 0; } } else { // this is the exceptional case // sort all the attributes, not just the other attributes for( int i=0; i<len; i++ ) otherAttributes.add(staticAttributes[i].toDynamicAttribute()); len = 0; Collections.sort(otherAttributes); // write them all int size = otherAttributes.size(); for( int i=0; i<size; i++ ) { DynamicAttribute a = otherAttributes.get(i); super.attribute(a.prefix,a.localName,a.value); } otherAttributes.clear(); } super.endStartTag(); }
@Override public void endStartTag() throws IOException { if(otherAttributes.isEmpty()) { if(len!=0) { // sort is expensive even for size 0 array, // so it's worth checking len==0 if(!namedAttributesAreOrdered) Arrays.sort(staticAttributes,0,len); // this is the common case for( int i=0; i<len; i++ ) staticAttributes[i].write(); len = 0; } } else { // this is the exceptional case // sort all the attributes, not just the other attributes for( int i=0; i<len; i++ ) otherAttributes.add(staticAttributes[i].toDynamicAttribute()); len = 0; Collections.sort(otherAttributes); // write them all int size = otherAttributes.size(); for( int i=0; i<size; i++ ) { DynamicAttribute a = otherAttributes.get(i); super.attribute(a.prefix,a.localName,a.value); } otherAttributes.clear(); } super.endStartTag(); }
@Override public void endStartTag() throws IOException { if(otherAttributes.isEmpty()) { if(len!=0) { // sort is expensive even for size 0 array, // so it's worth checking len==0 if(!namedAttributesAreOrdered) Arrays.sort(staticAttributes,0,len); // this is the common case for( int i=0; i<len; i++ ) staticAttributes[i].write(); len = 0; } } else { // this is the exceptional case // sort all the attributes, not just the other attributes for( int i=0; i<len; i++ ) otherAttributes.add(staticAttributes[i].toDynamicAttribute()); len = 0; Collections.sort(otherAttributes); // write them all int size = otherAttributes.size(); for( int i=0; i<size; i++ ) { DynamicAttribute a = otherAttributes.get(i); super.attribute(a.prefix,a.localName,a.value); } otherAttributes.clear(); } super.endStartTag(); }
@Override public void endStartTag() throws IOException { if(otherAttributes.isEmpty()) { if(len!=0) { // sort is expensive even for size 0 array, // so it's worth checking len==0 if(!namedAttributesAreOrdered) Arrays.sort(staticAttributes,0,len); // this is the common case for( int i=0; i<len; i++ ) staticAttributes[i].write(); len = 0; } } else { // this is the exceptional case // sort all the attributes, not just the other attributes for( int i=0; i<len; i++ ) otherAttributes.add(staticAttributes[i].toDynamicAttribute()); len = 0; Collections.sort(otherAttributes); // write them all int size = otherAttributes.size(); for( int i=0; i<size; i++ ) { DynamicAttribute a = otherAttributes.get(i); super.attribute(a.prefix,a.localName,a.value); } otherAttributes.clear(); } super.endStartTag(); }