arrayListObject = (ArrayList<String>) arrayListObject .stream() .sorted() .collect(Collectors.toList()); In