javolution.util.internal.map.FastMapImpl Maven / Gradle / Ivy
/*
* Javolution - Java(TM) Solution for Real-Time and Embedded Systems
* Copyright (C) 2012 - Javolution (http://javolution.org/)
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software is
* freely granted, provided that this notice is preserved.
*/
package javolution.util.internal.map;
import java.util.Iterator;
import java.util.NoSuchElementException;
import javolution.util.function.Equality;
/**
* The default {@link javolution.util.FastMap FastMap} implementation
* based on {@link FractalMapImpl fractal maps}.
* This implementation ensures that no more than 3/4 of the map capacity is
* ever wasted.
*/
public class FastMapImpl extends MapView {
private static final long serialVersionUID = 0x600L; // Version.
transient MapEntryImpl firstEntry = null;
transient FractalMapImpl fractal;
transient MapEntryImpl freeEntry = new MapEntryImpl();
final Equality super K> keyComparator;
transient MapEntryImpl lastEntry = null;
transient int size;
final Equality super V> valueComparator;
@SuppressWarnings("unchecked")
public FastMapImpl(Equality super K> keyComparator,
final Equality super V> valueComparator) {
super(null); // Root.
this.keyComparator = keyComparator;
this.valueComparator = valueComparator;
fractal = new FractalMapImpl((Equality