/** * Sort the keys alphabetically (ignoring case). Uses the value as a * tie-breaker (only really possible with a key that has a case change). * * @webref floatdict:method * @brief Sort the keys alphabetically */ public void sortKeys() { sortImpl(true, false, true); }
/** * @webref floatdict:method * @brief Sort the keys alphabetically in reverse */ public void sortKeysReverse() { sortImpl(true, true, true); }
/** * Set true to ensure that the order returned is identical. Slightly * slower because the tie-breaker for identical values compares the keys. * @param stable */ public void sortValues(boolean stable) { sortImpl(false, false, stable); }
/** * Sort by values in descending order (largest value will be at [0]). * * @webref floatdict:method * @brief Sort by values in ascending order */ public void sortValues() { sortImpl(false, false); // new InternalSort() { // @Override // public float compare(int a, int b) { // // } // }.run(); }
public void sortValuesReverse(boolean stable) { sortImpl(false, true, stable); }
/** * @webref floatdict:method * @brief Sort the keys alphabetially in reverse */ public void sortKeysReverse() { sortImpl(true, true); // new InternalSort() { // @Override // public float compare(int a, int b) { // int result = keys[b].compareToIgnoreCase(keys[a]); // if (result != 0) { // return result; // } // return values[a] - values[b]; // } // }.run(); }
/** * @webref floatdict:method * @brief Sort by values in descending order */ public void sortValuesReverse() { sortImpl(false, true); // new InternalSort() { // @Override // public float compare(int a, int b) { // float diff = values[b] - values[a]; // if (diff == 0 && keys[a] != null && keys[b] != null) { // diff = keys[a].compareToIgnoreCase(keys[b]); // } // return descending ? diff : -diff; // } // }.run(); }
/** * Sort the keys alphabetically (ignoring case). Uses the value as a * tie-breaker (only really possible with a key that has a case change). * * @webref floatdict:method * @brief Sort the keys alphabetically */ public void sortKeys() { sortImpl(true, false); // new InternalSort() { // @Override // public float compare(int a, int b) { // int result = keys[a].compareToIgnoreCase(keys[b]); // if (result != 0) { // return result; // } // return values[b] - values[a]; // } // }.run(); }