final ArrayList list = new ArrayList(); final Configuration[] children = config.getChildren( element );  for( int i = 0; i < children.length; i++ ) { if( null == attribute ) { list.add( children[ i ] ); } else { final String v = children[ i ].getAttribute( attribute, null );  if( v != null ) { if( (value == null) || v.equals( value ) ) {  list.add( children[ i ] ); } } } }  return (Configuration[])list.toArray( new Configuration[ list.size() ] );
return match( config, element, attribute, null );
    public static Configuration[] match( final Configuration config,                                         final String element,                                         final String attribute,                                         final String value )    {        final ArrayList list = new ArrayList();        final Configuration[] children = config.getChildren( element );        for( int i = 0; i < children.length; i++ )        {            if( null == attribute )            {                list.add( children[ i ] );            }            else            {                final String v =                    children[ i ].getAttribute( attribute, null );                if( v != null )                {                    if( (value == null) || v.equals( value ) )                    {                        // it's a match                        list.add( children[ i ] );                    }                }            }        }        return (Configuration[])list.toArray( new Configuration[ list.size() ] );    }