// Sort1.java
// Using algorithm sort.
package chapter36;

import java.util.List;
import java.util.Arrays;
import java.util.Collections;

public class Sort1
{
    private static final String suits[] =
            { "Hearts", "Diamonds", "Clubs", "Spades" };

    // display array elements
    public void printElements()
    {
        // Create List of Strings
        List< String > list = Arrays.asList( suits ); // create List

        // Implicit call to the list’s toString method to output the list contents
        System.out.printf( "Unsorted array elements:\n%s\n", list );

        // Use algorithm sort to order the elements of list in ascending order
        Collections.sort( list );

        // Implicit call to the list’s toString method to output the list contents
        System.out.printf( "Sorted array elements:\n%s\n", list );
    } // end method printElements

    public static void main( String args[] )
    {
        Sort1 sort1 = new Sort1();
        sort1.printElements();
    } // end main
} // end class Sort1
