@Override public int count(@Nullable Object element) { Multisets.ImmutableEntry<E>[] hashTable = this.hashTable; if (element == null || hashTable == null) { return 0; } int hash = Hashing.smearedHash(element); int mask = hashTable.length - 1; for (Multisets.ImmutableEntry<E> entry = hashTable[hash & mask]; entry != null; entry = entry.nextInBucket()) { if (Objects.equal(element, entry.getElement())) { return entry.getCount(); } } return 0; }
@Override public int count(@NullableDecl Object element) { Multisets.ImmutableEntry<E>[] hashTable = this.hashTable; if (element == null || hashTable == null) { return 0; } int hash = Hashing.smearedHash(element); int mask = hashTable.length - 1; for (Multisets.ImmutableEntry<E> entry = hashTable[hash & mask]; entry != null; entry = entry.nextInBucket()) { if (Objects.equal(element, entry.getElement())) { return entry.getCount(); } } return 0; }
NonTerminalEntry(E element, int count, ImmutableEntry<E> nextInBucket) { super(element, count); this.nextInBucket = nextInBucket; }
@Override public ImmutableEntry<E> nextInBucket() { return nextInBucket; }