Example #1
0
  public boolean insert(E x) {
    FHlinkedList<E> theList = mLists[myHash(x)];

    if (theList.contains(x)) return false;

    // not found so we insert
    theList.addLast(x);

    // check load factor
    if (++mSize > mMaxLambda * mTableSize) rehash();

    return true;
  }
Example #2
0
  public boolean remove(E x) {
    ListIterator<E> iter;
    FHlinkedList<E> theList = mLists[myHash(x)];

    // do not use contains() because it involves two passes through list
    for (iter = theList.listIterator(); iter.hasNext(); )
      if (x.equals(iter.next())) {
        iter.remove();
        mSize--;
        return true;
      }

    // not found
    return false;
  }
Example #3
0
  public boolean contains(E x) {
    FHlinkedList<E> theList = mLists[myHash(x)];

    return theList.contains(x);
  }