Question: I have HTML that looks like this:

```
    <table  cellspacing='0' border='0' width='100%'>
    <col align='left' />
    <tr>
    <td align='left'><font color='#FF0000'>Programming</font></td>
    </tr>
    </table>
    <table  cellspacing='0' border='0' width='100%'>
    <col align='left' />
    <col align='right' />
    <tr>
    <td align='left'><font color='#000000'>A1000</font></td>
    <td align='right'><font color='#008000'>D.Rogers</font></td>
    </tr>
    </table>

```

It is locally stored. I am trying to figure out how to data scrape "Programming","A1000" and "D.Rogers. How can I do this using Java and Jsoup?

Answer: 
`Array.protoype.sort` is not guaranteed to be *stable*. No guarantees are made that equal elements will retain their original order.

> 
> The `sort()` method sorts the elements of an array in place and returns the array. **The sort is not necessarily [stable](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability).** The default sort order is according to string Unicode code points.
> 
> 
> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort>
> 
> 
>
As stated [here](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description):

> 
> If compareFunction(a, b) returns 0, leave a and b unchanged with
>  respect to each other, but sorted with respect to all different
>  elements. Note: the ECMAscript standard does not guarantee this
>  behaviour, and thus not all browsers (e.g. Mozilla versions dating
>  back to at least 2003) respect this.
> 
> 
> 

Keeping in mind that the return of the compare function in your example will always be 0, and also refering to the answers in [this](https://stackoverflow.com/questions/9831330/how-does-the-javascript-sort-function-workas-an-algorithm) topic you can see how different browsers itterate over elements differently. Therefore the results of your case are to be expected and probably varry from browser to browser