public String next() { return key(++index); }
/** * @webref stringdict:method * @brief Remove a key/value pair */ public int remove(String key) { int index = index(key); if (index != -1) { removeIndex(index); } return index; }
/** * 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 stringdict:method * @brief Sort the keys alphabetically */ public void sortKeys() { sortImpl(true, false); }
public boolean hasNext() { return index+1 < size(); } };
/** Returns a duplicate copy of this object. */ public StringDict copy() { StringDict outgoing = new StringDict(count); System.arraycopy(keys, 0, outgoing.keys, 0, count); System.arraycopy(values, 0, outgoing.values, 0, count); for (int i = 0; i < count; i++) { outgoing.indices.put(keys[i], i); } outgoing.count = count; return outgoing; }
/** * Return a value for the specified key. * * @webref stringdict:method * @brief Return a value for the specified key */ public String get(String key) { int index = index(key); if (index == -1) return null; return values[index]; }
static protected StringDict parseStyleAttributes(String style) { //Map<String, String> table = new HashMap<String, String>(); StringDict table = new StringDict(); // if (style == null) return table; if (style != null) { String[] pieces = style.split(";"); for (int i = 0; i < pieces.length; i++) { String[] parts = pieces[i].split(":"); //table.put(parts[0], parts[1]); table.set(parts[0], parts[1]); } } return table; }
public void remove() { removeIndex(index); index--; }
@Override public void swap(int a, int b) { StringDict.this.swap(a, b); } };
/** * Return a copy of the internal keys array. This array can be modified. * * @webref stringdict:method * @brief Return a copy of the internal keys array */ public String[] keyArray() { return keyArray(null); }
public String next() { return value(++index); }
/** * @webref stringdict:method * @brief Remove a key/value pair */ public int remove(String key) { int index = index(key); if (index != -1) { removeIndex(index); } return index; }
/** * @webref stringdict:method * @brief Sort the keys alphabetically in reverse */ public void sortKeysReverse() { sortImpl(true, true); }
public boolean hasNext() { return index+1 < size(); } };
/** Returns a duplicate copy of this object. */ public StringDict copy() { StringDict outgoing = new StringDict(count); System.arraycopy(keys, 0, outgoing.keys, 0, count); System.arraycopy(values, 0, outgoing.values, 0, count); for (int i = 0; i < count; i++) { outgoing.indices.put(keys[i], i); } outgoing.count = count; return outgoing; }