Rakesh API

org.rakeshv.utils
Class FIFO<K,V>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,V>
          extended by java.util.LinkedHashMap<K,V>
              extended by org.rakeshv.utils.LinkedHashMap<K,V>
                  extended by org.rakeshv.utils.FIFO<K,V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map<K,V>

 class FIFO<K,V>
extends LinkedHashMap<K,V>

A First Iin First Out implementation using a LinkedHashMap.

Note: This class uses the LinkedHashMap introducted in the Java 1.4 version, and replaces the old implementation that has been renamed as SimpleFIFO.

Copyright 2004-2006 Rakesh Vidyadharan

Version:
$Id: FIFO.java,v 1.9 2006/03/11 04:15:14 rakesh Exp $
Author:
Rakesh Vidyadharan 2004 May 1

Nested Class Summary
 
Nested classes/interfaces inherited from class org.rakeshv.utils.LinkedHashMap
LinkedHashMap.Statistics
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry<K,V>
 
Field Summary
 
Fields inherited from class org.rakeshv.utils.LinkedHashMap
DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, FIFO_CACHE, LRU_CACHE
 
Constructor Summary
FIFO()
          Default constructor.
FIFO(int capacity)
          Constructs an empty insertion-ordered instance with the specified initial capacity and a default load factor of LinkedHashMap.DEFAULT_LOAD_FACTOR.
FIFO(int capacity, float loadFactor)
          Constructs an empty insertion-ordered instance with the specified initial capacity and load factor.
FIFO(java.util.Map<K,V> map)
          Constructs an insertion-ordered FIFO instance with the same mappings as the specified map.
 
Method Summary
 
Methods inherited from class org.rakeshv.utils.LinkedHashMap
clear, get, getMaxEntries, getStatistics, removeEldestEntry, setMaxEntries
 
Methods inherited from class java.util.LinkedHashMap
containsValue
 
Methods inherited from class java.util.HashMap
clone, containsKey, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
containsKey, containsValue, entrySet, equals, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Constructor Detail

FIFO

FIFO()
Default constructor. If this form of the constructor is used, the cache size will not be controlled.

See Also:
FIFO( int, float )

FIFO

FIFO(int capacity)
Constructs an empty insertion-ordered instance with the specified initial capacity and a default load factor of LinkedHashMap.DEFAULT_LOAD_FACTOR.

Parameters:
capacity - The maximum size for this map.
See Also:
FIFO( int, float )

FIFO

FIFO(int capacity,
     float loadFactor)
Constructs an empty insertion-ordered instance with the specified initial capacity and load factor. This is the designated constructor that is used by all other constructors.

Parameters:
capacity - The maximum size for this map.
loadFactor - The load-factor to use.

FIFO

FIFO(java.util.Map<K,V> map)
Constructs an insertion-ordered FIFO instance with the same mappings as the specified map. The FIFO instance is created with a a default load factor of LinkedHashMap.DEFAULT_LOAD_FACTOR and a capacity sufficient to hold the mappings in the specified map.

Parameters:
map - The map to use to create the new instance.
Throws:
java.lang.NullPointerException - If the specified map is null.
See Also:
FIFO( int )

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan