com.koloboke.collect.impl.hash.MutableLHashParallelKVObjKeyMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of koloboke-impl-jdk8 Show documentation
Show all versions of koloboke-impl-jdk8 Show documentation
Carefully designed and efficient extension of the Java Collections Framework with primitive specializations and more, built for Java 8 (Implementation)
The newest version!
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.koloboke.collect.impl.hash;
import com.koloboke.collect.*;
import com.koloboke.collect.hash.HashConfig;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Consumer;
import java.util.function.Predicate;
import com.koloboke.collect.impl.*;
import com.koloboke.collect.set.ObjSet;
import com.koloboke.collect.set.hash.HashObjSet;
import javax.annotation.Nonnull;
import java.util.*;
public abstract class MutableLHashParallelKVObjKeyMap
extends MutableParallelKVObjLHashGO {
public Equivalence keyEquivalence() {
return Equivalence.defaultEquality();
}
public final boolean containsKey(Object key) {
return contains(key);
}
@Nonnull
public HashObjSet keySet() {
return new KeyView();
}
abstract boolean justRemove(Object key);
class KeyView extends AbstractObjKeyView
implements HashObjSet, InternalObjCollectionOps, ParallelKVObjLHash {
@Override
@Nonnull
public Equivalence equivalence() {
return MutableLHashParallelKVObjKeyMap.this.keyEquivalence();
}
@Nonnull
@Override
public HashConfig hashConfig() {
return MutableLHashParallelKVObjKeyMap.this.hashConfig();
}
@Override
public HashConfigWrapper configWrapper() {
return MutableLHashParallelKVObjKeyMap.this.configWrapper();
}
@Override
public int size() {
return MutableLHashParallelKVObjKeyMap.this.size();
}
@Override
public double currentLoad() {
return MutableLHashParallelKVObjKeyMap.this.currentLoad();
}
@Nonnull
@Override
public Object[] table() {
return MutableLHashParallelKVObjKeyMap.this.table();
}
@Override
public int capacity() {
return MutableLHashParallelKVObjKeyMap.this.capacity();
}
@Override
public int freeSlots() {
return MutableLHashParallelKVObjKeyMap.this.freeSlots();
}
@Override
public boolean noRemoved() {
return MutableLHashParallelKVObjKeyMap.this.noRemoved();
}
@Override
public int removedSlots() {
return MutableLHashParallelKVObjKeyMap.this.removedSlots();
}
@Override
public int modCount() {
return MutableLHashParallelKVObjKeyMap.this.modCount();
}
@Override
public final boolean contains(Object o) {
return MutableLHashParallelKVObjKeyMap.this.contains(o);
}
@Override
public void forEach(Consumer super K> action) {
MutableLHashParallelKVObjKeyMap.this.forEach(action);
}
@Override
public boolean forEachWhile(Predicate super K>
predicate) {
return MutableLHashParallelKVObjKeyMap.this.forEachWhile(predicate);
}
@Override
public boolean allContainingIn(ObjCollection> c) {
return MutableLHashParallelKVObjKeyMap.this.allContainingIn(c);
}
@Override
public boolean reverseAddAllTo(ObjCollection super K> c) {
return MutableLHashParallelKVObjKeyMap.this.reverseAddAllTo(c);
}
@Override
public boolean reverseRemoveAllFrom(ObjSet> s) {
return MutableLHashParallelKVObjKeyMap.this.reverseRemoveAllFrom(s);
}
@Override
@Nonnull
public ObjIterator iterator() {
return MutableLHashParallelKVObjKeyMap.this.iterator();
}
@Override
@Nonnull
public ObjCursor cursor() {
return setCursor();
}
@Override
@Nonnull
public Object[] toArray() {
return MutableLHashParallelKVObjKeyMap.this.toArray();
}
@Override
@Nonnull
public T[] toArray(@Nonnull T[] a) {
return MutableLHashParallelKVObjKeyMap.this.toArray(a);
}
@Override
public int hashCode() {
return setHashCode();
}
@Override
public String toString() {
return setToString();
}
@Override
public boolean shrink() {
return MutableLHashParallelKVObjKeyMap.this.shrink();
}
@Override
public final boolean remove(Object o) {
return justRemove(o);
}
@Override
public boolean removeIf(Predicate super K> filter) {
return MutableLHashParallelKVObjKeyMap.this.removeIf(filter);
}
@SuppressWarnings("unchecked")
@Override
public boolean removeAll(@Nonnull Collection> c) {
if (c instanceof InternalObjCollectionOps) {
InternalObjCollectionOps c2 = (InternalObjCollectionOps) c;
if (c2.size() < this.size()
&& equivalence().equals(c2.equivalence())
) {
return c2.reverseRemoveAllFrom(this);
}
}
return MutableLHashParallelKVObjKeyMap.this.removeAll(this, c);
}
@Override
public boolean retainAll(@Nonnull Collection> c) {
return MutableLHashParallelKVObjKeyMap.this.retainAll(this, c);
}
@Override
public void clear() {
MutableLHashParallelKVObjKeyMap.this.clear();
}
}
}