Source Code Cross Referenced for MapEntryParameter.java in  » JMX » je » com » sleepycat » collections » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 » JMX » je » com.sleepycat.collections 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*-
002:         * See the file LICENSE for redistribution information.
003:         *
004:         * Copyright (c) 2000,2008 Oracle.  All rights reserved.
005:         *
006:         * $Id: MapEntryParameter.java,v 1.19.2.2 2008/01/07 15:14:06 cwl Exp $
007:         */
008:
009:        package com.sleepycat.collections;
010:
011:        import java.util.Map;
012:
013:        /**
014:         * A simple <code>Map.Entry</code> implementation that can be used as in
015:         * input parameter.  Since a <code>MapEntryParameter</code> is not obtained
016:         * from a map, it is not attached to any map in particular.  To emphasize that
017:         * changing this object does not change the map, the {@link #setValue} method
018:         * always throws <code>UnsupportedOperationException</code>.
019:         *
020:         * <p><b>Warning:</b> Use of this interface violates the Java Collections
021:         * interface contract since these state that <code>Map.Entry</code> objects
022:         * should only be obtained from <code>Map.entrySet()</code> sets, while this
023:         * class allows constructing them directly.  However, it is useful for
024:         * performing operations on an entry set such as add(), contains(), etc.  For
025:         * restrictions see {@link #getValue} and {@link #setValue}.</p>
026:         *
027:         * @author Mark Hayes
028:         */
029:        public class MapEntryParameter implements  Map.Entry {
030:
031:            private Object key;
032:            private Object value;
033:
034:            /**
035:             * Creates a map entry with a given key and value.
036:             *
037:             * @param key is the key to use.
038:             *
039:             * @param value is the value to use.
040:             */
041:            public MapEntryParameter(Object key, Object value) {
042:
043:                this .key = key;
044:                this .value = value;
045:            }
046:
047:            /**
048:             * Computes a hash code as specified by {@link
049:             * java.util.Map.Entry#hashCode}.
050:             *
051:             * @return the computed hash code.
052:             */
053:            public int hashCode() {
054:
055:                return ((key == null) ? 0 : key.hashCode())
056:                        ^ ((value == null) ? 0 : value.hashCode());
057:            }
058:
059:            /**
060:             * Compares this entry to a given entry as specified by {@link
061:             * java.util.Map.Entry#equals}.
062:             *
063:             * @return the computed hash code.
064:             */
065:            public boolean equals(Object other) {
066:
067:                if (!(other instanceof  Map.Entry)) {
068:                    return false;
069:                }
070:
071:                Map.Entry e = (Map.Entry) other;
072:
073:                return ((key == null) ? (e.getKey() == null) : key.equals(e
074:                        .getKey()))
075:                        && ((value == null) ? (e.getValue() == null) : value
076:                                .equals(e.getValue()));
077:            }
078:
079:            /**
080:             * Returns the key of this entry.
081:             *
082:             * @return the key of this entry.
083:             */
084:            public final Object getKey() {
085:
086:                return key;
087:            }
088:
089:            /**
090:             * Returns the value of this entry.  Note that this will be the value
091:             * passed to the constructor or the last value passed to {@link #setValue}.
092:             * It will not reflect changes made to a Map.
093:             *
094:             * @return the value of this entry.
095:             */
096:            public final Object getValue() {
097:
098:                return value;
099:            }
100:
101:            /**
102:             * Always throws <code>UnsupportedOperationException</code> since this
103:             * object is not attached to a map.
104:             */
105:            public Object setValue(Object newValue) {
106:
107:                throw new UnsupportedOperationException();
108:            }
109:
110:            final void setValueInternal(Object newValue) {
111:
112:                this .value = newValue;
113:            }
114:
115:            /**
116:             * Converts the entry to a string representation for debugging.
117:             *
118:             * @return the string representation.
119:             */
120:            public String toString() {
121:
122:                return "[key [" + key + "] value [" + value + ']';
123:            }
124:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.