Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Java Program to sort a List in case insensitive order

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class Demo {
	public static void main(String[] argv) throws Exception {
		String[] arr = new String[] { "P", "W", "g", "K", "H", "t", "E" };
		List<String>list = Arrays.asList(arr);
		System.out.println("List = "+list);
		Collections.sort(list);
		System.out.println("Case Sensitive Sort = "+list);
		Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
		System.out.println("Case Insensitive Sort = "+list);
	}
}

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.