IntCharSet implements Iterable<Integer> { public IntCharSet getCaseless(UnicodeProperties unicodeProperties) { IntCharSet n = copyOf(this); for (Interval elem : intervals) { for (int c = elem.start; c <= elem.end; c++) { IntCharSet equivalenceClass = unicodeProperties.getCaselessMatches(c); if (null != equivalenceClass) { n.add(equivalenceClass); } } } return n; }  static IntCharSet of(Interval interval); static IntCharSet of(Interval... intervals); static IntCharSet ofCharacterRange(int start, int end); static IntCharSet ofCharacter(int singleChar); static IntCharSet allChars(); static IntCharSet nlChars(); @SuppressWarnings("ReferenceEquality") void add(IntCharSet set); @SuppressWarnings("IncrementInForLoopAndHeader") void add(Interval interval); void add(int c); boolean contains(int singleChar); boolean contains(IntCharSet other); @Override boolean equals(Object o); @Override int hashCode(); IntCharSet and(IntCharSet set); @SuppressWarnings("ReferenceEquality") void sub(IntCharSet set); static IntCharSet complementOf(IntCharSet x); boolean containsElements(); int numIntervals(); List<Interval> getIntervals(); Iterator<Interval> intervalIterator(); IntCharSet getCaseless(UnicodeProperties unicodeProperties); @Override String toString(); static IntCharSet copyOf(IntCharSet intCharSet); int size(); @Override IntCharSetIterator iterator();  }
@Test public void getCaseless() throws Exception { UnicodeProperties unicodeProperties = new UnicodeProperties("4.0"); IntCharSet set = new IntCharSet(); set.add(new Interval('a', 'c')); set.add(new Interval('h', 'o')); assertWithMessage( "The caseless version should be ['A'-'C']['H'-'O']['a'-'c']['h'-'o'][304-305][8490]") .that(set.getCaseless(unicodeProperties)) .isEqualTo( IntCharSet.of( new Interval('A', 'C'), new Interval('H', 'O'), new Interval('a', 'c'), new Interval('h', 'o'), new Interval(0x130, 0x131), Interval.ofCharacter(0x212A))); }