com.koloboke.collect.impl.hash.UpdatableQHashSeparateKVShortKeyMap 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 com.koloboke.function.ShortConsumer;
import com.koloboke.function.ShortPredicate;
import java.util.function.Consumer;
import java.util.function.Predicate;
import com.koloboke.collect.impl.*;
import com.koloboke.collect.set.ShortSet;
import com.koloboke.collect.set.hash.HashShortSet;
import javax.annotation.Nonnull;
import java.util.*;
public abstract class UpdatableQHashSeparateKVShortKeyMap
extends UpdatableSeparateKVShortQHashGO {
public final boolean containsKey(Object key) {
return contains(key);
}
public boolean containsKey(short key) {
return contains(key);
}
@Nonnull
public HashShortSet keySet() {
return new KeyView();
}
abstract boolean justRemove(short key);
class KeyView extends AbstractShortKeyView
implements HashShortSet, InternalShortCollectionOps, SeparateKVShortQHash {
@Nonnull
@Override
public HashConfig hashConfig() {
return UpdatableQHashSeparateKVShortKeyMap.this.hashConfig();
}
@Override
public HashConfigWrapper configWrapper() {
return UpdatableQHashSeparateKVShortKeyMap.this.configWrapper();
}
@Override
public int size() {
return UpdatableQHashSeparateKVShortKeyMap.this.size();
}
@Override
public double currentLoad() {
return UpdatableQHashSeparateKVShortKeyMap.this.currentLoad();
}
@Override
public short freeValue() {
return UpdatableQHashSeparateKVShortKeyMap.this.freeValue();
}
@Override
public boolean supportRemoved() {
return UpdatableQHashSeparateKVShortKeyMap.this.supportRemoved();
}
@Override
public short removedValue() {
return UpdatableQHashSeparateKVShortKeyMap.this.removedValue();
}
@Nonnull
@Override
public short[] keys() {
return UpdatableQHashSeparateKVShortKeyMap.this.keys();
}
@Override
public int capacity() {
return UpdatableQHashSeparateKVShortKeyMap.this.capacity();
}
@Override
public int freeSlots() {
return UpdatableQHashSeparateKVShortKeyMap.this.freeSlots();
}
@Override
public boolean noRemoved() {
return UpdatableQHashSeparateKVShortKeyMap.this.noRemoved();
}
@Override
public int removedSlots() {
return UpdatableQHashSeparateKVShortKeyMap.this.removedSlots();
}
@Override
public int modCount() {
return UpdatableQHashSeparateKVShortKeyMap.this.modCount();
}
@Override
public final boolean contains(Object o) {
return UpdatableQHashSeparateKVShortKeyMap.this.contains(o);
}
@Override
public boolean contains(short key) {
return UpdatableQHashSeparateKVShortKeyMap.this.contains(key);
}
@Override
public void forEach(Consumer super Short> action) {
UpdatableQHashSeparateKVShortKeyMap.this.forEach(action);
}
@Override
public void forEach(ShortConsumer action) {
UpdatableQHashSeparateKVShortKeyMap.this.forEach(action);
}
@Override
public boolean forEachWhile(ShortPredicate
predicate) {
return UpdatableQHashSeparateKVShortKeyMap.this.forEachWhile(predicate);
}
@Override
public boolean allContainingIn(ShortCollection c) {
return UpdatableQHashSeparateKVShortKeyMap.this.allContainingIn(c);
}
@Override
public boolean reverseAddAllTo(ShortCollection c) {
return UpdatableQHashSeparateKVShortKeyMap.this.reverseAddAllTo(c);
}
@Override
public boolean reverseRemoveAllFrom(ShortSet s) {
return UpdatableQHashSeparateKVShortKeyMap.this.reverseRemoveAllFrom(s);
}
@Override
@Nonnull
public ShortIterator iterator() {
return UpdatableQHashSeparateKVShortKeyMap.this.iterator();
}
@Override
@Nonnull
public ShortCursor cursor() {
return setCursor();
}
@Override
@Nonnull
public Object[] toArray() {
return UpdatableQHashSeparateKVShortKeyMap.this.toArray();
}
@Override
@Nonnull
public T[] toArray(@Nonnull T[] a) {
return UpdatableQHashSeparateKVShortKeyMap.this.toArray(a);
}
@Override
public short[] toShortArray() {
return UpdatableQHashSeparateKVShortKeyMap.this.toShortArray();
}
@Override
public short[] toArray(short[] a) {
return UpdatableQHashSeparateKVShortKeyMap.this.toArray(a);
}
@Override
public int hashCode() {
return setHashCode();
}
@Override
public String toString() {
return setToString();
}
@Override
public boolean shrink() {
return UpdatableQHashSeparateKVShortKeyMap.this.shrink();
}
@Override
public final boolean remove(Object o) {
return justRemove((Short) o);
}
@Override
public boolean removeShort(short v) {
return justRemove(v);
}
@Override
public boolean removeIf(Predicate super Short> filter) {
return UpdatableQHashSeparateKVShortKeyMap.this.removeIf(filter);
}
@Override
public boolean removeIf(ShortPredicate filter) {
return UpdatableQHashSeparateKVShortKeyMap.this.removeIf(filter);
}
@Override
public boolean removeAll(@Nonnull Collection> c) {
if (c instanceof ShortCollection) {
if (c instanceof InternalShortCollectionOps) {
InternalShortCollectionOps c2 = (InternalShortCollectionOps) c;
if (c2.size() < this.size()) {
return c2.reverseRemoveAllFrom(this);
}
}
return UpdatableQHashSeparateKVShortKeyMap.this.removeAll(this, (ShortCollection) c);
}
return UpdatableQHashSeparateKVShortKeyMap.this.removeAll(this, c);
}
@Override
public boolean retainAll(@Nonnull Collection> c) {
return UpdatableQHashSeparateKVShortKeyMap.this.retainAll(this, c);
}
@Override
public void clear() {
UpdatableQHashSeparateKVShortKeyMap.this.clear();
}
}
}