Buggy code:
public abstract class MarkupContainer extends Component { private static final Log log = LogFactory . getLog ( MarkupContainer . class ) ; private Object children ; private transient MarkupStream markupStream ; public MarkupContainer ( final String id ) { } public MarkupContainer ( final String id , IModel model ) { } public MarkupContainer add ( final Component child ) { } public boolean autoAdd ( final Component component ) { } public final boolean contains ( final Component component , final boolean recurse ) { } public final Component get ( final String path ) { } public String getMarkupType ( ) { } public void internalAdd ( final Component child ) { } public void internalBeginRequest ( ) { } public void internalEndRequest ( ) { } public final Iterator iterator ( ) { } public final Iterator iterator ( Comparator comparator ) { final List sorted ; if ( ( children ) == null ) { sorted = Collections . EMPTY_LIST ; } else { if ( ( children ) instanceof Component ) { sorted = new ArrayList ( 1 ) ; sorted . add ( children ) ; } else { sorted = Arrays . asList ( ( ( Component [ ] ) ( children ) ) ) ; } } <START_BUG> Collections . sort ( sorted ) ; <END_BUG> return sorted . iterator ( ) ; } public void remove ( final Component component ) { } public void remove ( final String id ) { } public void removeAll ( ) { } public final void renderAssociatedMarkup ( final String openTagName , final String exceptionMessage ) { } public MarkupContainer replace ( final Component child ) { } public Component setModel ( final IModel model ) { } public final int size ( ) { } public String toString ( ) { } public String toString ( final boolean detailed ) { } public final Object visitChildren ( final Class c , final IVisitor visitor ) { } public final Object visitChildren ( final IVisitor visitor ) { } protected final MarkupStream findMarkupStream ( ) { } protected final MarkupStream getAssociatedMarkupStream ( ) { } protected MarkupStream getMarkupStream ( ) { } protected void onComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { } protected void onRender ( ) { } protected void renderAll ( final MarkupStream markupStream ) { } protected final void renderComponentTagBody ( final MarkupStream markupStream , final ComponentTag openTag ) { } protected final void setMarkupStream ( final MarkupStream markupStream ) { } final boolean hasAssociatedMarkup ( ) { } private final void addedComponent ( final Component component ) { } private final void children_add ( final Component child ) { } private final Component children_get ( int index ) { } private final Component children_get ( final String id ) { } private final int children_indexOf ( Component child ) { } private final Component children_remove ( Component component ) { } private final Component children_remove ( int index ) { } private final Component children_set ( int index , Component child ) { } private final int children_size ( ) { } private final Component put ( final Component child ) { } private final void removedComponent ( final Component component ) { } private final void renderNext ( final MarkupStream markupStream ) { } }

Fix:
Collections . sort ( sorted , comparator ) ;