org.apache.commons.collections.map

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache common Collections » org.apache.commons.collections.map 
org.apache.commons.collections.map

This package contains implementations of the {@link java.util.Map Map}, {@link org.apache.commons.collections.IterableMap IterableMap}, {@link org.apache.commons.collections.OrderedMap OrderedMap} and {@link java.util.SortedMap SortedMap} interfaces. A Map provides a lookup from a key to a value. A number of implementations also support the new MapIterator interface that enables simple iteration of map keys and values.

The following implementations are provided:

  • CaseInsensitiveMap - map that compares keys in a case insensitive way
  • CompositeMap - map that combines multiple maps into a single view
  • HashedMap - general purpose HashMap replacement supporting MapIterator
  • IdentityMap - map that uses == for comparison instead of equals()
  • Flat3Map - designed for good performance at size 3 or less
  • LinkedMap - a hash map that maintains insertion order, supporting OrderedMapIterator
  • MultiKeyMap - map that provides special methods for using more than one key to access the value
  • ReferenceMap - allows the garbage collector to collect keys and values using equals() for comparison
  • ReferenceIdentityMap - allows the garbage collector to collect keys and values using == for comparison
  • SingletonMap - a fully featured map to hold one key-value pair
  • StaticBucketMap - internally synchronized and designed for thread-contentious environments

The following decorators are provided:

  • Unmodifiable - ensures the collection cannot be altered
  • Predicated - ensures that only elements that are valid according to a predicate can be added
  • Typed - ensures that only elements that are of a specific type can be added
  • Transformed - transforms each element added
  • FixedSize - ensures that the size of the map cannot change
  • Lazy - creates objects in the map on demand
  • ListOrdered - ensures that insertion order is retained
Java Source File NameTypeComment
AbstractHashedMap.javaClass An abstract implementation of a hash-based map which provides numerous points for subclasses to override.

This class implements all the features necessary for a subclass hash-based map. Key-value entries are stored in instances of the HashEntry class, which can be overridden and replaced.

AbstractInputCheckedMapDecorator.javaClass An abstract base class that simplifies the task of creating map decorators.

The Map API is very difficult to decorate correctly, and involves implementing lots of different classes.

AbstractLinkedMap.javaClass An abstract implementation of a hash-based map that links entries to create an ordered map and which provides numerous points for subclasses to override.

This class implements all the features necessary for a subclass linked hash-based map.

AbstractMapDecorator.javaClass Provides a base decorator that enables additional functionality to be added to a Map via decoration.

Methods are forwarded directly to the decorated map.

This implementation does not perform any special processing with AbstractMapDecorator.entrySet() , AbstractMapDecorator.keySet() or AbstractMapDecorator.values() .

AbstractOrderedMapDecorator.javaClass Provides a base decorator that enables additional functionality to be added to an OrderedMap via decoration.

Methods are forwarded directly to the decorated map.

This implementation does not perform any special processing with the map views. Instead it simply returns the set/collection from the wrapped map.

AbstractReferenceMap.javaClass An abstract implementation of a hash-based map that allows the entries to be removed by the garbage collector.

This class implements all the features necessary for a subclass reference hash-based map.

AbstractSortedMapDecorator.javaClass Provides a base decorator that enables additional functionality to be added to a Map via decoration.

Methods are forwarded directly to the decorated map.

This implementation does not perform any special processing with the map views. Instead it simply returns the set/collection from the wrapped map.

AbstractTestIterableMap.javaClass Abstract test class for IterableMap methods and contracts.
AbstractTestMap.javaClass Abstract test class for java.util.Map methods and contracts.

The forces at work here are similar to those in AbstractTestCollection . If your class implements the full Map interface, including optional operations, simply extend this class, and implement the AbstractTestMap.makeEmptyMap() method.

On the other hand, if your map implementation is weird, you may have to override one or more of the other protected methods.

AbstractTestOrderedMap.javaClass Abstract test class for OrderedMap methods and contracts.
AbstractTestSortedMap.javaClass Abstract test class for java.util.SortedMap methods and contracts.
CaseInsensitiveMap.javaClass A case-insensitive Map.

As entries are added to the map, keys are converted to all lowercase.

CompositeMap.javaClass Decorates a map of other maps to provide a single unified view.

Changes made to this map will actually be made on the decorated map. Add and remove operations require the use of a pluggable strategy.

DefaultedMap.javaClass Decorates another Map returning a default value if the map does not contain the requested key.

When the DefaultedMap.get(Object) method is called with a key that does not exist in the map, this map will return the default value specified in the constructor/factory.

FixedSizeMap.javaClass Decorates another Map to fix the size, preventing add/remove.

Any action that would change the size of the map is disallowed. The put method is allowed to change the value associated with an existing key however.

If trying to remove or clear the map, an UnsupportedOperationException is thrown.

FixedSizeSortedMap.javaClass Decorates another SortedMap to fix the size blocking add/remove.

Any action that would change the size of the map is disallowed. The put method is allowed to change the value associated with an existing key however.

If trying to remove or clear the map, an UnsupportedOperationException is thrown.

Flat3Map.javaClass A Map implementation that stores data in simple fields until the size is greater than 3.

This map is designed for performance and can outstrip HashMap. It also has good garbage collection characteristics.

  • Optimised for operation at size 3 or less.
  • Still works well once size 3 exceeded.
  • Gets at size 3 or less are about 0-10% faster than HashMap,
  • Puts at size 3 or less are over 4 times faster than HashMap.
  • Performance 5% slower than HashMap once size 3 exceeded once.
The design uses two distinct modes of operation - flat and delegate. While the map is size 3 or less, operations map straight onto fields using switch statements.
HashedMap.javaClass A Map implementation that is a general purpose alternative to HashMap.

This implementation improves on the JDK1.4 HashMap by adding the org.apache.commons.collections.MapIterator MapIterator functionality and many methods for subclassing.

Note that HashedMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization.

IdentityMap.javaClass A Map implementation that matches keys and values based on == not equals().

This map will violate the detail of various Map and map view contracts. As a general rule, don't compare this map to other maps.

Note that IdentityMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization.

LazyMap.javaClass Decorates another Map to create objects in the map on demand.

When the LazyMap.get(Object) method is called with a key that does not exist in the map, the factory is used to create the object.

LazySortedMap.javaClass Decorates another SortedMap to create objects in the map on demand.

When the LazySortedMap.get(Object) method is called with a key that does not exist in the map, the factory is used to create the object.

LinkedMap.javaClass A Map implementation that maintains the order of the entries. In this implementation order is maintained by original insertion.

This implementation improves on the JDK1.4 LinkedHashMap by adding the org.apache.commons.collections.MapIterator MapIterator functionality, additional convenience methods and allowing bidirectional iteration.

ListOrderedMap.javaClass Decorates a Map to ensure that the order of addition is retained using a List to maintain order.

The order will be used via the iterators and toArray methods on the views. The order is also returned by the MapIterator. The orderedMapIterator() method accesses an iterator that can iterate both forwards and backwards through the map. In addition, non-interface methods are provided to access the map by index.

If an object is added to the Map for a second time, it will remain in the original position in the iteration.

Note that ListOrderedMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization.

LRUMap.javaClass A Map implementation with a fixed maximum size which removes the least recently used entry if an entry is added when full.

The least recently used algorithm works on the get and put operations only. Iteration of any kind, including setting the value by iteration, does not change the order.

MultiKeyMap.javaClass A Map implementation that uses multiple keys to map the value.

This class is the most efficient way to uses multiple keys to map to a value. The best way to use this class is via the additional map-style methods. These provide get, containsKey, put and remove for individual keys which operate without extra object creation.

The additional methods are the main interface of this map. As such, you will not normally hold this map in a variable of type Map.

The normal map methods take in and return a MultiKey . If you try to use put() with any other object type a ClassCastException is thrown.

MultiValueMap.javaClass A MultiValueMap decorates another map, allowing it to have more than one value for a key.

A MultiMap is a Map with slightly different semantics. Putting a value into the map will add the value to a Collection at that key. Getting a value will return a Collection, holding all the values put to that key.

This implementation is a decorator, allowing any Map implementation to be used as the base.

In addition, this implementation allows the type of collection used for the values to be controlled.

PredicatedMap.javaClass Decorates another Map to validate that additions match a specified predicate.

This map exists to provide validation for the decorated map. It is normally created to decorate an empty map. If an object cannot be added to the map, an IllegalArgumentException is thrown.

One usage would be to ensure that no null keys are added to the map.

Map map = PredicatedSet.decorate(new HashMap(), NotNullPredicate.INSTANCE, null);

Note that PredicatedMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization.

PredicatedSortedMap.javaClass Decorates another SortedMap to validate that additions match a specified predicate.

This map exists to provide validation for the decorated map. It is normally created to decorate an empty map. If an object cannot be added to the map, an IllegalArgumentException is thrown.

One usage would be to ensure that no null keys are added to the map.

SortedMap map = PredicatedSortedSet.decorate(new TreeMap(), NotNullPredicate.INSTANCE, null);

Note that PredicatedSortedMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization.

ReferenceIdentityMap.javaClass A Map implementation that allows mappings to be removed by the garbage collector and matches keys and values based on == not equals().

When you construct a ReferenceIdentityMap, you can specify what kind of references are used to store the map's keys and values. If non-hard references are used, then the garbage collector can remove mappings if a key or value becomes unreachable, or if the JVM's memory is running low.

ReferenceMap.javaClass A Map implementation that allows mappings to be removed by the garbage collector.

When you construct a ReferenceMap, you can specify what kind of references are used to store the map's keys and values. If non-hard references are used, then the garbage collector can remove mappings if a key or value becomes unreachable, or if the JVM's memory is running low.

SingletonMap.javaClass A Map implementation that holds a single item and is fixed size.
StaticBucketMap.javaClass A StaticBucketMap is an efficient, thread-safe implementation of java.util.Map that performs well in in a highly thread-contentious environment.
TestAll.javaClass Entry point for tests.
TestCaseInsensitiveMap.javaClass Tests for the CaseInsensitiveMap implementation.
TestCompositeMap.javaClass Extension of AbstractTestMap for exercising the CompositeMap implementation.
TestDefaultedMap.javaClass Extension of TestMap for exercising the DefaultedMap implementation.
TestFixedSizeMap.javaClass Extension of AbstractTestMap for exercising the FixedSizeMap implementation.
TestFixedSizeSortedMap.javaClass Extension of TestSortedMap for exercising the FixedSizeSortedMap implementation.
TestFlat3Map.javaClass JUnit tests.
TestHashedMap.javaClass JUnit tests.
TestIdentityMap.javaClass JUnit tests.
TestLazyMap.javaClass Extension of TestMap for exercising the LazyMap implementation.
TestLazySortedMap.javaClass Extension of TestLazyMap for exercising the LazySortedMap implementation.
TestLinkedMap.javaClass JUnit tests.
TestListOrderedMap.javaClass Extension of TestMap for exercising the ListOrderedMap implementation.
TestListOrderedMap2.javaClass Extension of TestMap for exercising the ListOrderedMap implementation.
TestLRUMap.javaClass JUnit tests.
TestMultiKeyMap.javaClass JUnit tests.
TestMultiValueMap.javaClass TestMultiValueMap.
TestPredicatedMap.javaClass Extension of TestMap for exercising the PredicatedMap implementation.
TestPredicatedSortedMap.javaClass Extension of TestPredicatedMap for exercising the PredicatedSortedMap implementation.
TestReferenceIdentityMap.javaClass Tests for ReferenceIdentityMap.
TestReferenceMap.javaClass Tests for ReferenceMap.
TestSingletonMap.javaClass JUnit tests.
TestStaticBucketMap.javaClass Unit tests. StaticBucketMap .
version:
   $Revision: 348273 $ $Date: 2005-11-22 22:24:25 +0000 (Tue, 22 Nov 2005) $
author:
   Michael A.
TestTransformedMap.javaClass Extension of TestMap for exercising the TransformedMap implementation.
TestTransformedSortedMap.javaClass Extension of AbstractTestSortedMap for exercising the TransformedSortedMap implementation.
TestUnmodifiableMap.javaClass Extension of AbstractTestMap for exercising the UnmodifiableMap implementation.
TestUnmodifiableOrderedMap.javaClass Extension of AbstractTestOrderedMap for exercising the UnmodifiableOrderedMap implementation.
TestUnmodifiableSortedMap.javaClass Extension of AbstractTestSortedMap for exercising the UnmodifiableSortedMap implementation.
TransformedMap.javaClass Decorates another Map to transform objects that are added.

The Map put methods and Map.Entry setValue method are affected by this class. Thus objects must be removed or searched for using their transformed form. For example, if the transformation converts Strings to Integers, you must use the Integer form to remove objects.

Note that TransformedMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization.

TransformedSortedMap.javaClass Decorates another SortedMap to transform objects that are added.

The Map put methods and Map.Entry setValue method are affected by this class. Thus objects must be removed or searched for using their transformed form. For example, if the transformation converts Strings to Integers, you must use the Integer form to remove objects.

Note that TransformedSortedMap is not synchronized and is not thread-safe. If you wish to use this map from multiple threads concurrently, you must use appropriate synchronization.

TypedMap.javaClass Decorates another Map to validate that elements added are of a specific type.

The validation of additions is performed via an instanceof test against a specified Class.

TypedSortedMap.javaClass Decorates another SortedMap to validate that elements added are of a specific type.

The validation of additions is performed via an instanceof test against a specified Class.

UnmodifiableEntrySet.javaClass Decorates a map entry Set to ensure it can't be altered.
UnmodifiableMap.javaClass Decorates another Map to ensure it can't be altered.
UnmodifiableOrderedMap.javaClass Decorates another OrderedMap to ensure it can't be altered.
UnmodifiableSortedMap.javaClass Decorates another SortedMap to ensure it can't be altered.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.