Postgres Function Select Into Arraylist Sorting Java