Typescript Get Next Element In Javascript Object Sorting In Java