About 1,510,000 results
Open links in new tab
  1. 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 compareTo () method and compare one string with the rest of the strings.

  2. Java program for sorting a given list of names in ascending order

    Jan 21, 2025 · In this article we will learn to implement a Java program for sorting a given list of names in ascending order. A Java program is provided for sorting a given list of names or …

  3. Write a Java program for sorting a given list of names in ascending order

    In this program, we will learn to write a Java program for sorting a given list of names in ascending order. The input for this program is a set of names and the output is the same names arranged in ascending order. This program uses the technique of Bubble sort to sort the names.

  4. Java Program to Sort an ArrayList - GeeksforGeeks

    May 17, 2021 · An ArrayList can be sorted in two ways ascending and descending order. The collection class provides two methods for sorting ArrayList. sort () and reverseOrder () for ascending and descending order respectively.

  5. Java Program to Sort the Elements of an Array in Ascending Order

    Nov 14, 2024 · In this example, we will use the Arrays.sort () method that comes under java.util.Arrays class. This method uses a highly optimized algorithm i.e. the Dual-Pivot Quicksort for primitive types and efficiently sorts the array elements in ascending order.

  6. Java program to sort a given list of names in ascending order

    names [i]= input [i]; } for(int i =0; i <k; i ++) for(int j = i +1; j <k; j ++) { if(names [i]. compareTo(names [j])<0) { temp = names [i]; names [i]= names [j]; names [j]= temp; } } …

  7. java - how to sort an ArrayList in ascending order using …

    Two ways to get this done: Collections.sort(myArray) given elements inside myArray implements Comparable Second Collections.sort(myArray, new MyArrayElementComparator()); where MyArrayElementComparator is Comparator for elements inside myArray

  8. Sort List in ascending order in Java - Techie Delight

    Apr 1, 2024 · Collections utility class provides a static sort() method for sorting the specified list into ascending order, according to the natural ordering of its elements. This method will produce a stable sort.

  9. Java Collections.sort - Complete Tutorial with Examples

    Sorting is a fundamental operation in programming. The Collections.sort method offers efficient sorting algorithms for Lists. It uses a modified mergesort algorithm that offers n log (n) performance. Collections.sort Overview The Collections.sort method sorts the specified list into ascending order.

  10. Java 8 Lambda - Sort List in Ascending and Descending Order ...

    In this tutorial, we will see how to sort List (ArrayList) in ascending and descending order using Java Lambda expressions.

  11. Some results have been removed
Refresh