function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kanhaiya Yadav 4Kanhaiya Yadav 4 

Position of characters after sorting from list

Hi,
     I have list of characters(Unsorted & duplicate). I want know actual index value after sorting.

  e.g.
   List<string> str =new List<string>{'c','m','a','x','a','n','c','p','z'}
after sorting it will be
 List<String> str =new List<string>{'a','a','c','c','m','n','p','x','z'}
 I want to know position of characters after sorting.

Thanks in advance
Kanhaiya
 
SHAHNA MULLASHAHNA MULLA
Hi Kanhaiya,
To know index of values in a list, you can use indexOf(listElement) method.

It returns the index of the first occurrence of the specified element in this list. If this list does not contain the element, returns -1.

public Integer indexOf(Object listElement);

Hope it will help you.