About 381,000 results
Open links in new tab
  1. java - Comparing strings by their alphabetical order - Stack Overflow

    Jan 12, 2016 · If you just want to sort them in alphabetical order regardless of case (so that "a" comes before "Z"), you can use String.compareToIgnoreCase: s1.compareToIgnoreCase(s2); …

  2. Java Alphabetizing Strings - Stack Overflow

    How about putting the Strings in a List and call the sort() method? The Java String class implements the 'Comparable' interface and thus already has the compareTo() method, which …

  3. Sort a String in Java (2 different ways) - GeeksforGeeks

    Mar 18, 2024 · There exist two methods with which we can sort any string in java alphabetically. Illustration: Now let us discuss methods and implement the same. Method 1: Without using the …

  4. Java Program to Sort Names in an Alphabetical Order

    Sep 15, 2022 · In the input, the user has to enter the number of names and the names and on the output, it will sort and display them in alphabetical order. For this, we are going to use the …

  5. Sorting a String Alphabetically in Java - Baeldung

    Mar 17, 2024 · In this quick article, we’ve shown how the String might be sorted in alphabetical order in two ways. Also, we’ve implemented the anagram validator which made use of the …

  6. java - How can I sort a List alphabetically? - Stack Overflow

    Apr 2, 2009 · // Java 8 version List<String> sortedNames = names.stream().sorted().collect(Collectors.toList()); // Guava version List<String> …

  7. Sorting Strings Alphabetically in Java - Javacodepoint

    In this article, we will explore different ways to sort an array of strings lexicographically in Java using Arrays.sort(), Collections.sort(), and custom comparators for case-insensitive and …

  8. Sort a String Alphabetically in Java - HowToDoInJava

    Jul 11, 2023 · Learn to sort a string alphabetically using Stream.sort(), Arrays.sort() and custom sort() method using simple arrays and swapping example.

  9. How to Compare Strings Alphabetically in Java - Delft Stack

    Feb 2, 2024 · Below, we have examples that show three ways of comparing strings alphabetically in Java. The compareTo() method compares two strings lexicographically based on their …

  10. Java Program to Sort Strings in an Alphabetical Order

    May 11, 2023 · In this , we will learn how to sort Strings in an Alphabetical Order. In this program, we are asking user to enter the count of strings that he would like to enter for sorting. Once the …

  11. Some results have been removed
Refresh