Java Utililty Methods TreeSet

List of utility methods to do TreeSet

Description

The list of methods to do TreeSet are organized into topic(s).

Method

voidaddSplits(TreeSet splitKeys, byte[] prefix, int splitBits)
add Splits
if (splitBits == 0)
    return;
if (splitBits < 0 || splitBits > 16)
    throw new IllegalArgumentException("Illegal nunmber of split bits");
final int splitStep = 1 << (16 - splitBits);
for (int i = splitStep; i <= 0xFFFF; i += splitStep) {
    byte bb[] = Arrays.copyOf(prefix, prefix.length + 2);
    bb[prefix.length] = (byte) ((i >> 8) & 0xff);
...
TreeSetbuildTreeSet(Collection elements)
build Tree Set
return new TreeSet<T>(elements);
TreeSetchangeComparator(TreeSet set, Comparator cmp)
Clears the initial set, and creates a new one with same contents and has the specified comparator.
TreeSet<T> ret = new TreeSet<T>(cmp);
ret.addAll(set);
set.clear();
return ret;
Stringconcatenate(TreeSet in)
concatenate
StringBuffer buffer = new StringBuffer();
for (String element : in) {
    buffer.append(element.trim().replaceAll(CONCATENATION_TOKEN + "", CONCATENATION_SUBSTITUTE + ""));
    buffer.append(CONCATENATION_TOKEN);
String result = buffer.toString();
return result;
intconvertSpanToSparseGrid(final int curIx, final int span, final TreeSet indexes)
Spanning is specified in the uncompressed grid number.
final int lastIx = curIx + span;
int retSpan = 1;
for (final Integer ix : indexes) {
    if (ix <= curIx) {
        continue; 
    if (ix >= lastIx) {
        break;
...
TreeSetcreateTreeSet(Iterable c)
create Tree Set
return createTreeSet(null, c);
TreeSetcvtListToTreeSet(List list)
cvt List To Tree Set
TreeSet treeSet = new TreeSet();
if (treeSet != null) {
    Iterator iter = list.iterator();
    while (iter.hasNext()) {
        treeSet.add(iter.next());
return treeSet;
...
TreeSetfindSizedSubdirs(final String size, final TreeSet themeSubdirs)
find Sized Subdirs
final TreeSet<String> sizedSubDirs = new TreeSet<String>();
for (String subdir : themeSubdirs) {
    if (subdir.startsWith(size)) {
        sizedSubDirs.add(subdir);
return sizedSubDirs;
intgetDockInsets(final TreeSet set)
get Dock Insets
int c = 0;
for (final Integer i : set) {
    if (i < -MAX_GRID) {
        c++;
    } else {
        break; 
return c;
SetgetTreeSet(Collection collection)
get Tree Set
return new TreeSet<E>(collection);