React Array Sort Python Method Vs Function In Java