Dave's Brain

Browse - Programming Tips - How can I make a case-insensitive HashSet ?

Date: 2016jun6
Language: Java
Keywords: HashMap, TreeMap

Q.  How can I make a case-insensitive HashSet ?

A.  Use TreeSet like this:

TreeSet<String> myset = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.