Sorting a string list
Jan 02, 2021 13:07 0 Comments Other components GANESH MALLA

 You would think this would be easy.  Searched WmPublic and PSUtilities and found nothing.  Googled and didn't find much either.  So I created a java service sortStringList of my own.

inList - StringList
ascending - boolean

sortedList - StringList

    public static final void sortStringList(IData pipeline) throws ServiceException {
        // pipeline
        IDataCursor pipelineCursor = pipeline.getCursor();
            String[]    inList = IDataUtil.getStringArray( pipelineCursor, "inList" );
            String    ascending = IDataUtil.getString( pipelineCursor, "ascending" );
        // pipeline
        IDataCursor pipelineCursor_1 = pipeline.getCursor();
        String[]    sortedList = inList.clone();
        if (ascending.equalsIgnoreCase("true")) {
        } else {
            List list = Arrays.asList(sortedList);
            Collections.sort(list, Collections.reverseOrder() );
        IDataUtil.put( pipelineCursor_1, "sortedList", sortedList );

Prev Next
About the Author
Topic Replies (0)
Leave a Reply
Guest User

You might also like

Not sure what course is right for you?

Choose the right course for you.
Get the help of our experts and find a course that best suits your needs.

Let`s Connect