hsearch method

ENTRY? hsearch(
  1. ENTRY item,
  2. int action
)

Searches the hash table for an item with the same key as item. If action is FIND, it returns the item or null if not found. If action is ENTER, it inserts the item and returns it.

Implementation

ENTRY? hsearch(ENTRY item, int action) {
  if (_hsearchTable == null) return null;
  if (action == FIND) {
    return _hsearchTable![item.key];
  } else {
    if (!_hsearchTable!.containsKey(item.key)) {
      _hsearchTable![item.key] = item;
    }
    return _hsearchTable![item.key];
  }
}