I am trying to sort an arraylist that has custom objects. I want to sort my arraylist based on a property inside the object.
Below is my code:
List<Object[]> search = qry1.getResultList();
Below is my output:
"searchresults" = ArrayList<E> 
elementData=Object[33]
[0] = Object[10] 
    [0] = "Dog"
    [1] = "Animal"
    [2] = "Carnivorous"
[1] = Object[10]
    [0] = "Lion"
    [1] = "Animal"
    [2] = "Carnivorous"
[2] = Object[10]
    [0] = "Cow"
    [1] = "Animal"
    [2] = "Herbivorous"
[3] = Object[10]
    [0] = "Buffalo"
    [1] = "Animal"
    [2] = "Herbivorous"
Now i want to sort the result based on the animal name(Buffalo, Dog, Lion)
I tried using java 8 function but didnt work. Also tried using comparator but didnt work:
search.stream().sorted(comp1, comp2);
Please guide.
