2005-07-16 00:30:23 +00:00
|
|
|
/* Hashtable.java -- a class providing a basic hashtable data structure,
|
|
|
|
mapping Object --> Object
|
2006-01-17 18:09:40 +00:00
|
|
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006
|
|
|
|
Free Software Foundation, Inc.
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
This file is part of GNU Classpath.
|
|
|
|
|
|
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
02110-1301 USA.
|
|
|
|
|
|
|
|
Linking this library statically or dynamically with other modules is
|
|
|
|
making a combined work based on this library. Thus, the terms and
|
|
|
|
conditions of the GNU General Public License cover the whole
|
|
|
|
combination.
|
|
|
|
|
|
|
|
As a special exception, the copyright holders of this library give you
|
|
|
|
permission to link this library with independent modules to produce an
|
|
|
|
executable, regardless of the license terms of these independent
|
|
|
|
modules, and to copy and distribute the resulting executable under
|
|
|
|
terms of your choice, provided that you also meet, for each linked
|
|
|
|
independent module, the terms and conditions of the license of that
|
|
|
|
module. An independent module is a module which is not derived from
|
|
|
|
or based on this library. If you modify this library, you may extend
|
|
|
|
this exception to your version of the library, but you are not
|
|
|
|
obligated to do so. If you do not wish to do so, delete this
|
|
|
|
exception statement from your version. */
|
|
|
|
|
|
|
|
package java.util;
|
|
|
|
|
re PR libgcj/37636 (java tools are unable to find resource files)
libjava/ChangeLog:
2008-10-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
* sources.am, Makfile.in: Regenerate.
2008-10-17 Matthias Klose <doko@ubuntu.com>
* configure.ac: Fix bashisms.
* configure: Regenerate.
2008-10-15 Matthias Klose <doko@ubuntu.com>
* configure.ac: Disable build of gjdoc, if configured without
--with-antlr-jar or if no antlr.jar found.
* configure: Regenerate.
2008-10-09 Andrew John Hughes <gnu_andrew@member.fsf.org>
* classpath/configure.ac,
* classpath/m4/ac_prog_antlr.m4,
* classpath/m4/ac_prog_java.m4,
* classpath/tools/Makefile.am:
Ported --regen-gjdoc-parser patch and
cantlr support from GNU Classpath.
2008-10-06 Andrew Haley <aph@redhat.com>
* java/lang/Thread.java (Thread): Always create the ThreadLocalMap
when creating a thread.
(getThreadLocals) Don't lazily create the ThreadLocalMap.
2008-09-28 Andrew John Hughes <gnu_andrew@member.fsf.org>
* classpath/java/lang/ThreadLocalMap.java,
* java/lang/ThreadLocalMap$Entry.h,
* java/lang/ThreadLocalMap.h,
* lib/java/lang/ThreadLocalMap.class,
* lib/java/lang/ThreadLocalMap$Entry.class:
Add the new files for the ThreadLocal patch.
2008-09-28 Andrew John Hughes <gnu_andrew@member.fsf.org>
* classpath/ChangeLog,
* classpath/java/lang/InheritableThreadLocal.java,
* classpath/java/lang/Thread.java,
* classpath/java/lang/ThreadLocal.java:
Merge Daniel Frampton's ThreadLocal patch.
* gcj/javaprims.h: Updated.
* java/lang/Thread.h: Regenerated.
* java/lang/Thread.java:
Replace WeakIdentityHashMap with ThreadLocalMap.
(getThreadLocals()): Likewise.
* java/lang/ThreadLocal.h: Regenerated.
* java/lang/ThreadLocal.java:
(computeNextHash()): New method.
(ThreadLocal()): Initialise fastHash.
(internalGet()): Updated to match Classpath's get().
(internalSet(Object)): Likewise for set(Object).
(internalRemove()): Likewise for remove().
2008-09-25 Andrew John Hughes <gnu_andrew@member.fsf.org>
* classpath/configure,
* classpath/configure.ac:
Resynchronise with Classpath's configure.
* classpath/examples/Makefile.in:
Add equivalent support for building as in
tools/Makefile.in.
* classpath/java/nio/Buffer.java,
* classpath/java/nio/ByteBuffer.java,
* classpath/java/nio/ByteBufferImpl.java,
* classpath/java/nio/CharBuffer.java,
* classpath/java/nio/CharBufferImpl.java,
* classpath/java/nio/CharSequenceBuffer.java,
* classpath/java/nio/CharViewBufferImpl.java,
* classpath/java/nio/DirectByteBufferImpl.java,
* classpath/java/nio/DoubleBuffer.java,
* classpath/java/nio/DoubleBufferImpl.java,
* classpath/java/nio/DoubleViewBufferImpl.java,
* classpath/java/nio/FloatBuffer.java,
* classpath/java/nio/FloatBufferImpl.java,
* classpath/java/nio/FloatViewBufferImpl.java,
* classpath/java/nio/IntBuffer.java,
* classpath/java/nio/IntBufferImpl.java,
* classpath/java/nio/IntViewBufferImpl.java,
* classpath/java/nio/LongBuffer.java,
* classpath/java/nio/LongBufferImpl.java,
* classpath/java/nio/LongViewBufferImpl.java,
* classpath/java/nio/MappedByteBuffer.java,
* classpath/java/nio/MappedByteBufferImpl.java,
* classpath/java/nio/ShortBuffer.java,
* classpath/java/nio/ShortBufferImpl.java,
* classpath/java/nio/ShortViewBufferImpl.java:
Replace use of gnu.classpath.Pointer with gnu.gcj.RawData,
and fix some formatting issues.
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaLexer.java,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaLexer.smap,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaRecognizer.java,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaRecognizer.smap,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaTokenTypes.java,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaTokenTypes.txt:
Regenerated (later version of antlr).
* java/nio/Buffer.h: Regenerated.
* java/nio/Buffer.java: Ported changes from Classpath.
* java/nio/ByteBuffer.h,
* java/nio/CharBuffer.h: Regenerated.
* java/nio/DirectByteBufferImpl.java: Ported changes from
Classpath.
* java/nio/DoubleBuffer.h,
* java/nio/FloatBuffer.h,
* java/nio/IntBuffer.h,
* java/nio/LongBuffer.h,
* java/nio/MappedByteBuffer.h,
* java/nio/MappedByteBufferImpl.h: Regenerated.
* java/nio/MappedByteBufferImpl.java: Ported changes from
Classpath.
* java/nio/ShortBuffer.h: Regenerated.
2008-09-24 Matthias Klose <doko@ubuntu.com>
* configure.ac: Search for antlr.jar, if not configured.
* configure: Regenerate.
2008-09-24 Matthias Klose <doko@ubuntu.com>
* Makefile.am: Build a gjdoc binary, if enabled.
* configure.ac: Add options --disable-gjdoc, --with-antlr-jar=file.
* Makefile.in, */Makefile.in, configure: Regenerate.
2008-09-22 Andrew Haley <aph@redhat.com>
* java/lang/String.java (toString(char[], int, int)): New method.
2008-09-14 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (libgcj-import-20080914).
* Regenerate class and header files.
* Regenerate auto* files.
* configure.ac: Don't pass --disable-gjdoc to classpath.
* sources.am: Regenerated.
* HACKING: Mention to build gjdoc in maintainer builds.
* gnu/classpath/Configuration.java: Update classpath version.
* gcj/javaprims.h: Update.
2008-09-08 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Makefile.am: Replace natStringBuffer.cc
and natStringBuilder.cc with natAbstractStringBuffer.cc.
* Makefile.in: Regenerated.
* java/lang/AbstractStringBuffer.java:
(append(int)): Made native.
(regionMatches(int,String)): Likewise.
* java/lang/StringBuffer.h: Regenerated.
* java/lang/StringBuffer.java: Remerged with GNU Classpath.
* java/lang/StringBuilder.h: Regenerated.
* java/lang/StringBuilder.java: Remerged with GNU Classpath.
* java/lang/natAbstractStringBuffer.cc: Provide common
native methods for StringBuffer and StringBuilder.
* java/lang/natStringBuffer.cc,
* java/lang/natStringBuilder.cc: Removed.
2008-09-04 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Makefile.in,
* classpath/configure: Regenerated.
* gnu/gcj/util/natDebug.cc,
* gnu/gcj/xlib/natColormap.cc,
* gnu/gcj/xlib/natDisplay.cc,
* gnu/gcj/xlib/natDrawable.cc,
* gnu/gcj/xlib/natFont.cc,
* gnu/gcj/xlib/natWMSizeHints.cc,
* gnu/gcj/xlib/natWindow.cc,
* gnu/gcj/xlib/natXImage.cc:
Add :: prefix to namespaces.
* java/io/CharArrayWriter.h,
* java/lang/StringBuffer.h:
Regenerated using patched gjavah.
* java/lang/natStringBuffer.cc:
Fix naming of append(jint).
* java/sql/Timestamp.h: Regenerated
using patched gjavah.
* jni.cc: Rename p to functions
to match change in GNU Classpath.
* scripts/makemake.tcl: Switch
gnu.java.math to BC compilation.
* sources.am: Regenerated.
2008-08-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Makefile.in: Updated location of Configuration.java.
* classpath/lib/gnu/java/locale/LocaleData.class: Regenerated.
2008-08-18 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Makefile.in: Updated with new Java files.
* classpath/configure: Regenerated.
* classpath/tools/Makefile.am: Add missing
use of GJDOC_EX so --disable-gjdoc works.
* classpath/tools/Makefile.in: Regenerated.
2008-08-15 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (libgcj-import-20080811).
* Regenerate class and header files.
* Regenerate auto* files.
* configure.ac: Don't pass --with-fastjar to classpath, substitute new
dummy value in classpath/gnu/classpath/Configuration.java.in, pass
--disable-gjdoc to classpath.
* scripts/makemake.tcl:
* sources.am: Regenerated.
* java/lang/AbstractStringBuffer.java, gnu/java/lang/VMCPStringBuilder.java:
New, copied from classpath, use System instead of VMSystem.
* java/lang/StringBuffer.java: Merge from classpath.
* java/lang/ClassLoader.java: Merge from classpath.
* gcj/javaprims.h: Update class definitions,
remove _Jv_jobjectRefType, jobjectRefType definitions.
libjava/classpath/ChangeLog.gcj:
2008-10-21 Matthias Klose <doko@ubuntu.com>
* classpath/tools/gnu/classpath/tools/gjdoc/expr/Java*: Move from ...
* classpath/tools/generated/gnu/classpath/tools/gjdoc/expr/ ... here.
* Update .class files.
2008-10-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/Makefile.am:
Always generate parser in the srcdir.
2008-10-21 Matthias Klose <doko@ubuntu.com>
* doc/Makefile.am (MAINTAINERCLEANFILES): Add gjdoc.1.
* doc/Makefile.in: Regenerate.
2008-10-20 Matthias Klose <doko@ubuntu.com>
* configure.ac: Don't check for working java, if not configured
with --enable-java-maintainer-mode.
* configure: Regenerate.
2008-10-19 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_java.m4: Revert previous change.
* m4/ac_prog_javac.m4: Apply it here.
* configure: Regenerate.
2008-10-19 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_javac.m4: Don't check for working javac, if not configured
with --enable-java-maintainer-mode.
* configure: Regenerate.
* Makefile.in, */Makefile.in: Regenerate.
2008-09-30 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_antlr.m4: Check for cantlr binary as well.
2008-09-29 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_antlr.m4: Check for antlr binary as well.
2008-09-28 Matthias Klose <doko@ubuntu.com>
* PR libgcj/37636. Revert:
2008-02-20 Matthias Klose <doko@ubuntu.com>
* tools/Makefile.am ($(TOOLS_ZIP)): Revert part of previous change,
Do copy resource files in JAVA_MAINTAINER_MODE only.
* tools/Makefile.in: Regenerate.
2008-09-14 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_javac_works.m4, m4/ac_prog_javac.m4, m4/acinclude.m4:
Revert local changes.
* m4/ac_prog_antlr.m4: Check for an runantlr binary.
* tools/Makefile.am, lib/Makefile.am: Revert local changes (JCOMPILER).
* tools/Makefile.am: Remove USE_JAVAC_FLAGS, pass ANTLR_JAR in
GLIBJ_CLASSPATH.
2008-09-14 Matthias Klose <doko@ubuntu.com>
Revert:
Daniel Frampton <zyridium at zyridium.net>
* AUTHORS: Added.
* java/lang/InheritableThreadLocal.java,
* java/lang/Thread.java,
* java/lang/ThreadLocal.java:
Modified to use java.lang.ThreadLocalMap.
* java/lang/ThreadLocalMap.java:
New cheaper ThreadLocal-specific WeakHashMap.
2008-08-15 Matthias Klose <doko@ubuntu.com>
* m4/acinclude.m4 (CLASSPATH_JAVAC_MEM_CHECK): Remove unknown
args for javac.
libjava/classpath/ChangeLog:
2008-10-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* m4/ac_prog_antlr.m4:
Remove redundant checks.
* tools/Makefile.am:
Use gjdoc_gendir when calling antlr.
2008-10-15 Andrew John Hughes <gnu_andrew@member.fsf.org>
* configure.ac:
Remove superfluous AC_PROG_JAVA call.
2008-10-06 Andrew John Hughes <gnu_andrew@member.fsf.org>
* m4/ac_prog_antlr:
Check for cantlr as well.
* tools/Makefile.am:
Only build GJDoc parser when both
CREATE_GJDOC and CREATE_GJDOC_PARSER
are on.
2008-10-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
* configure.ac:
Add regen-gjdoc-parser option,
and separate antlr tests.
* m4/ac_prog_antlr.m4:
Turn single test into AC_LIB_ANTLR
and AC_PROG_ANTLR.
* m4/ac_prog_java.m4:
Quote tests.
* tools/Makefile.am:
Support CREATE_GJDOC_PARSER option.
2008-09-14 Andrew John Hughes <gnu_andrew@member.fsf.org>
* examples/Makefile.am:
Check lib directly as well as glibj.zip
for boot classes.
* m4/acinclude.m4:
Only require the class files to be built
to allow the tools and examples to be built,
not the installation of glibj.zip.
* tools/Makefile.am:
Check lib directly as well as glibj.zip
for boot classes.
2008-09-13 Andrew John Hughes <gnu_andrew@member.fsf.org>
* examples/Makefile.am,
* lib/Makefile.am:
Add GCJ rules.
* m4/ac_prog_javac.m4:
Check whether JAVAC is gcj.
* m4/ac_prog_javac_works.m4:
Add GCJ rules.
* m4/acinclude.m4:
Don't bother checking for -J
if using GCJ.
* tools/Makefile.am:
Add GCJ rules.
2007-08-23 Daniel Frampton <zyridium@zyridium.net>
* AUTHORS: Added.
* java/lang/InheritableThreadLocal.java,
* java/lang/Thread.java,
* java/lang/ThreadLocal.java:
Modified to use java.lang.ThreadLocalMap.
* java/lang/ThreadLocalMap.java:
New cheaper ThreadLocal-specific WeakHashMap.
2008-02-07 Ian Rogers <ian.rogers@manchester.ac.uk>
* java/util/zip/ZipEntry.java:
Use byte fields instead of integer fields,
store the time as well as the DOS time and
don't retain a global Calendar instance.
(setDOSTime(int)): Set KNOWN_DOSTIME instead
of KNOWN_TIME, and unset KNOWN_TIME.
(getDOSTime()): Compute DOS time from UNIX time
only when needed.
(clone()): Provide cloning via the ZipEntry constructor
where possible.
(setTime(long)): Don't compute DOS time at this point.
(getCalendar()): Removed.
2008-09-09 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/gnu/classpath/tools/getopt/Parser.java:
(setHeader(String)): Make synchronized.
(setFooter(String)): Likewise.
* tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java,
(reset()): Make synchronized.
(name(Class)): Likewise.
2008-09-04 Robert Schuster <robertschuster@fsfe.org>
* gnu/java/nio/charset/ByteDecodeLoopHelper:
(arrayDecodeLoop): Added new break label, escape to that label.
* gnu/java/nio/charset/ByteEncodeLoopHelper:
(arrayDecodeLoop): Added new break label, escape to that label.
2008-09-04 Robert Schuster <robertschuster@fsfe.org>
* java/text/DecimalFormat.java:
(scanFix): Use 'i + 1' when looking at following character.
(scanNegativePattern): Dito.
2008-09-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/gnu/classpath/tools/javah/ClassWrapper.java:
(makeVtable()): Populate methodNameMap.
(printMethods(CniPrintStream)): Always use pre-populated
methodNameMap for bridge targets.
2008-09-01 Mario Torre <neugens@aicas.com>
* gnu/java/awt/peer/x/XImage.java (XImageProducer): remove @Override
annotation to allow compilation on javac < 1.6 and ecj < 3.4.
2008-09-01 Mario Torre <neugens@aicas.com>
* gnu/java/awt/peer/x/XGraphicsDevice.java (getDisplay): fix to support
new Escher API.
* gnu/java/awt/peer/x/XImage.java (getSource): method implemented.
* gnu/java/awt/peer/x/XImage.java (XImageProducer): implement ImageProducer
for getSource.
2008-09-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/java/util/regex/BacktrackStack.java,
* gnu/java/util/regex/CharIndexed.java,
* gnu/java/util/regex/CharIndexedCharArray.java,
* gnu/java/util/regex/CharIndexedCharSequence.java,
* gnu/java/util/regex/CharIndexedInputStream.java,
* gnu/java/util/regex/CharIndexedString.java,
* gnu/java/util/regex/CharIndexedStringBuffer.java,
* gnu/java/util/regex/RE.java,
* gnu/java/util/regex/REException.java,
* gnu/java/util/regex/REFilterInputStream.java,
* gnu/java/util/regex/REMatch.java,
* gnu/java/util/regex/REMatchEnumeration.java,
* gnu/java/util/regex/RESyntax.java,
* gnu/java/util/regex/REToken.java,
* gnu/java/util/regex/RETokenAny.java,
* gnu/java/util/regex/RETokenBackRef.java,
* gnu/java/util/regex/RETokenChar.java,
* gnu/java/util/regex/RETokenEnd.java,
* gnu/java/util/regex/RETokenEndOfPreviousMatch.java,
* gnu/java/util/regex/RETokenEndSub.java,
* gnu/java/util/regex/RETokenIndependent.java,
* gnu/java/util/regex/RETokenLookAhead.java,
* gnu/java/util/regex/RETokenLookBehind.java,
* gnu/java/util/regex/RETokenNamedProperty.java,
* gnu/java/util/regex/RETokenOneOf.java,
* gnu/java/util/regex/RETokenPOSIX.java,
* gnu/java/util/regex/RETokenRange.java,
* gnu/java/util/regex/RETokenRepeated.java,
* gnu/java/util/regex/RETokenStart.java,
* gnu/java/util/regex/RETokenWordBoundary.java,
* gnu/java/util/regex/UncheckedRE.java:
Fix indentation.
2008-09-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/java/util/regex/RETokenStart.java:
(getMaximumLength()): Add Override annotation.
(matchThis(CharIndexed, REMatch)): Likewise.
(returnsFixedLengthMatches()): Renamed from
returnsFixedLengthmatches and added Override
annotation.
(findFixedLengthMatches(CharIndexed,REMatch,int)):
Add Override annotation.
(dump(CPStringBuilder)): Likewise.
* gnu/javax/print/ipp/IppRequest.java:
(RequestWriter.writeOperationAttributes(AttributeSet)):
Throw exception, don't just create and drop it.
* javax/management/MBeanServerPermission.java:
(MBeanServerPermissionCollection.add(Permission)): Compare
against individual Strings not the entire array, and
store the result of replace.
* javax/swing/text/html/StyleSheet.java:
(setBaseFontSize(size)): Store result of trim().
2008-09-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/tools/FileObject.java:
(openReader(boolean)): Document new parameter.
2008-03-27 Michael Franz <mvfranz@gmail.com>
PR classpath/35690:
* javax/tools/FileObject.java:
(toUri()): Fix case from toURI.
(openReader(boolean)): Add missing boolean argument.
2008-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/35487:
* gnu/javax/management/Server.java:
(beans): Change to ConcurrentHashMap.
(defaultDomain): Make final.
(outer): Likewise.
(LazyListenersHolder): Added to wrap
listeners, also now a ConcurrentHashMap,
providing lazy initialisation safely.
(sequenceNumber): Documented.
(getBean(ObjectName)): Remove redundant cast.
(addNotificationListener(ObjectName,NotificationListener,
NotificationFilter,Object)): Remove map initialisation
and use holder.
(getObjectInstance(ObjectName)): Remove redundant cast.
(registerMBean(Object,ObjectName)): Add bean atomically.
(removeNotificationListener(ObjectName,NotificationListener)):
Simplified.
(removeNotificationListener(ObjectName,NotificationListener,
NotificationFilter,Object)): Likewise.
(notify(ObjectName,String)): Documented.
2008-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/javax/management/Server.java:
Genericised.
2008-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/javax/management/Translator.java:
Genericised.
2008-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/DefaultLoaderRepository.java,
* javax/management/JMX.java,
* javax/management/MBeanAttributeInfo.java,
* javax/management/MBeanConstructorInfo.java,
* javax/management/MBeanOperationInfo.java,
* javax/management/MBeanServerDelegate.java:
Fix warnings due to generics.
2008-08-25 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/MBeanPermission.java,
* javax/management/MBeanServerDelegate.java,
* javax/management/MBeanServerFactory.java,
* javax/management/MBeanServerInvocationHandler.java,
* javax/management/MBeanServerPermission.java:
Fix warnings due to use of non-generic collections.
2008-08-25 Mario Torre <neugens@aicas.com>
* gnu/javax/rmi/CORBA/RmiUtilities.java (readValue): check if sender is
null to avoid NPE.
2008-08-22 Mario Torre <neugens@aicas.com>
* gnu/CORBA/OrbFunctional.java (set_parameters): Fix
NullPointerException checking when param is null.
2008-08-23 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/util/regex/Matcher.java:
(reset()): Reset append position so
we don't try and append to the end of
the old input.
2008-08-22 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/32028:
* m4/acinclude.m4:
Also allow versions of GJDoc from 0.8* on, as
CVS is 0.8.0-pre.
2008-08-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/32028:
* m4/acinclude.m4:
(CLASSPATH_WITH_GJDOC): Ensure version 0.7.9 is
being used.
2008-08-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/Makefile.am:
Add taglets subdirectory to list of excluded
paths when GJDoc is not compiled.
2008-08-19 David P Grove <groved@us.ibm.com>
* scripts/check_jni_methods.sh.in:
Fix build issue on AIX by splitting generation
of method list.
2008-08-18 Andrew John Hughes <gnu_andrew@member.fsf.org>
* native/jni/gstreamer-peer/gst_native_pipeline.c:
(get_free_space(int)): Use #else not #elif when
there is no condition.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/31895:
* java/text/DecimalFormat.java:
(setCurrency(Currency)): Update prefixes and
suffixes when currency changes.
* java/text/DecimalFormatSymbols.java:
(DecimalFormatSymbols(Locale)): Set locale earlier
so it can be used by setCurrency(Currency).
(setCurrency(Currency)): Set the symbol correctly using
the locale of the instance.
* java/util/Currency.java:
Throw error instead of just printing a message.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/activation/ActivationDataFlavor.java:
Suppress warnings from public API.
(mimeType): Made final.
(representationClass): Added generic type and
made final.
(normalizeMimeTypeParameter(String,String)):
Use CPStringBuilder.
* javax/activation/CommandInfo.java:
(verb): Made final.
(className): Made final.
* javax/activation/DataHandler.java:
(dataSource): Made final.
* javax/activation/FileDataSource.java:
(file): Made final.
* javax/activation/MailcapCommandMap.java:
Use generics on collections and CPStringBuilder
instead of StringBuffer.
* javax/activation/MimeType.java:
(toString()): Use CPStringBuilder.
(getBaseType()): Likewise.
* javax/activation/MimeTypeParameterList.java:
Use generics on collections and CPStringBuilder
instead of StringBuffer.
* javax/activation/MimeTypeParseException.java:
(MimeTypeParseException(String,String)): Use
CPStringBuilder.
* javax/activation/MimetypesFileTypeMap.java:
Use generics on collections and CPStringBuilder
instead of StringBuffer.
* javax/activation/URLDataSource.java:
(url): Made final.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/javax/activation/viewers/ImageViewer.java,
* gnu/javax/activation/viewers/TextEditor.java,
* gnu/javax/activation/viewers/TextViewer.java,
* javax/activation/ActivationDataFlavor.java,
* javax/activation/CommandInfo.java,
* javax/activation/CommandMap.java,
* javax/activation/CommandObject.java,
* javax/activation/DataContentHandler.java,
* javax/activation/DataContentHandlerFactory.java,
* javax/activation/DataHandler.java,
* javax/activation/DataHandlerDataSource.java,
* javax/activation/DataSource.java,
* javax/activation/DataSourceDataContentHandler.java,
* javax/activation/FileDataSource.java,
* javax/activation/FileTypeMap.java,
* javax/activation/MailcapCommandMap.java,
* javax/activation/MimeType.java,
* javax/activation/MimeTypeParameterList.java,
* javax/activation/MimeTypeParseException.java,
* javax/activation/MimetypesFileTypeMap.java,
* javax/activation/ObjectDataContentHandler.java,
* javax/activation/URLDataSource.java,
* javax/activation/UnsupportedDataTypeException.java,
* javax/activation/package.html,
* resource/META-INF/mailcap.default,
* resource/META-INF/mimetypes.default:
Import GNU JAF CVS as of 17/08/2008.
2006-04-25 Archit Shah <ashah@redhat.com>
* javax/activation/MimeTypeParameterList.java:
Insert ';' separator before parameter list.
2005-06-29 Xavier Poinsard <xpoinsard@openpricer.com>
* javax/activation/ObjectDataContentHandler.java:
Fixed typo.
2005-05-28 Chris Burdess <dog@bluezoo.org>
* javax/activation/CommandMap.java,
* javax/activation/MailcapCommandMap.java:
Updated to JAF 1.1.
2004-06-09 Chris Burdess <dog@bluezoo.org>
* javax/activation/MailcapCommandMap.java:
Fixed bug whereby x-java prefix was not
attempted.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* AUTHORS: Added Laszlo.
2008-04-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/30436:
* java/util/Scanner.java:
Fix package to be java.util and correct
indentation.
2007-07-25 Laszlo Andras Hernadi <e0327023@student.tuwien.ac.at>
PR classpath/30436:
* java/util/Scanner.java:
Initial implementation.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/util/regex/Matcher.java:
(toMatchResult()): Implemented.
2008-08-13 Joshua Sumali <jsumali@redhat.com>
* doc/Makefile.am (gjdoc.pod): Generate gjdoc pod from cp-tools.texinfo
instead of invoke.texi. Remove invoke.texi from EXTRA_DIST.
* doc/invoke.texi: Removed and merged into ...
* doc/cp-tools.texinfo: Here
2008-08-12 Robert Schuster <robertschuster@fsfe.org>
* native/jni/java-net/local.c
(local_bind): Removed fprintf call, fixed access outside
of array bounds.
From-SVN: r141271
2008-10-21 17:55:01 +00:00
|
|
|
import gnu.java.lang.CPStringBuilder;
|
|
|
|
|
2005-07-16 00:30:23 +00:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.ObjectInputStream;
|
|
|
|
import java.io.ObjectOutputStream;
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
|
|
|
// NOTE: This implementation is very similar to that of HashMap. If you fix
|
|
|
|
// a bug in here, chances are you should make a similar change to the HashMap
|
|
|
|
// code.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A class which implements a hashtable data structure.
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* This implementation of Hashtable uses a hash-bucket approach. That is:
|
|
|
|
* linear probing and rehashing is avoided; instead, each hashed value maps
|
|
|
|
* to a simple linked-list which, in the best case, only has one node.
|
|
|
|
* Assuming a large enough table, low enough load factor, and / or well
|
|
|
|
* implemented hashCode() methods, Hashtable should provide O(1)
|
|
|
|
* insertion, deletion, and searching of keys. Hashtable is O(n) in
|
|
|
|
* the worst case for all of these (if all keys hash to the same bucket).
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* This is a JDK-1.2 compliant implementation of Hashtable. As such, it
|
|
|
|
* belongs, partially, to the Collections framework (in that it implements
|
|
|
|
* Map). For backwards compatibility, it inherits from the obsolete and
|
|
|
|
* utterly useless Dictionary class.
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* Being a hybrid of old and new, Hashtable has methods which provide redundant
|
|
|
|
* capability, but with subtle and even crucial differences.
|
|
|
|
* For example, one can iterate over various aspects of a Hashtable with
|
|
|
|
* either an Iterator (which is the JDK-1.2 way of doing things) or with an
|
|
|
|
* Enumeration. The latter can end up in an undefined state if the Hashtable
|
|
|
|
* changes while the Enumeration is open.
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* Unlike HashMap, Hashtable does not accept `null' as a key value. Also,
|
|
|
|
* all accesses are synchronized: in a single thread environment, this is
|
|
|
|
* expensive, but in a multi-thread environment, this saves you the effort
|
|
|
|
* of extra synchronization. However, the old-style enumerators are not
|
|
|
|
* synchronized, because they can lead to unspecified behavior even if
|
|
|
|
* they were synchronized. You have been warned.
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* The iterators are <i>fail-fast</i>, meaning that any structural
|
|
|
|
* modification, except for <code>remove()</code> called on the iterator
|
|
|
|
* itself, cause the iterator to throw a
|
|
|
|
* <code>ConcurrentModificationException</code> rather than exhibit
|
|
|
|
* non-deterministic behavior.
|
|
|
|
*
|
|
|
|
* @author Jon Zeppieri
|
|
|
|
* @author Warren Levy
|
|
|
|
* @author Bryce McKinlay
|
|
|
|
* @author Eric Blake (ebb9@email.byu.edu)
|
|
|
|
* @see HashMap
|
|
|
|
* @see TreeMap
|
|
|
|
* @see IdentityHashMap
|
|
|
|
* @see LinkedHashMap
|
|
|
|
* @since 1.0
|
|
|
|
* @status updated to 1.4
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public class Hashtable<K, V> extends Dictionary<K, V>
|
|
|
|
implements Map<K, V>, Cloneable, Serializable
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
// WARNING: Hashtable is a CORE class in the bootstrap cycle. See the
|
|
|
|
// comments in vm/reference/java/lang/Runtime for implications of this fact.
|
|
|
|
|
|
|
|
/** Default number of buckets. This is the value the JDK 1.3 uses. Some
|
|
|
|
* early documentation specified this value as 101. That is incorrect.
|
|
|
|
*/
|
|
|
|
private static final int DEFAULT_CAPACITY = 11;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The default load factor; this is explicitly specified by the spec.
|
|
|
|
*/
|
|
|
|
private static final float DEFAULT_LOAD_FACTOR = 0.75f;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Compatible with JDK 1.0+.
|
|
|
|
*/
|
|
|
|
private static final long serialVersionUID = 1421746759512286392L;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The rounded product of the capacity and the load factor; when the number
|
|
|
|
* of elements exceeds the threshold, the Hashtable calls
|
|
|
|
* <code>rehash()</code>.
|
|
|
|
* @serial
|
|
|
|
*/
|
|
|
|
private int threshold;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load factor of this Hashtable: used in computing the threshold.
|
|
|
|
* @serial
|
|
|
|
*/
|
|
|
|
private final float loadFactor;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Array containing the actual key-value mappings.
|
|
|
|
*/
|
|
|
|
// Package visible for use by nested classes.
|
2007-01-09 19:58:05 +00:00
|
|
|
transient HashEntry<K, V>[] buckets;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Counts the number of modifications this Hashtable has undergone, used
|
|
|
|
* by Iterators to know when to throw ConcurrentModificationExceptions.
|
|
|
|
*/
|
|
|
|
// Package visible for use by nested classes.
|
|
|
|
transient int modCount;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The size of this Hashtable: denotes the number of key-value pairs.
|
|
|
|
*/
|
|
|
|
// Package visible for use by nested classes.
|
|
|
|
transient int size;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The cache for {@link #keySet()}.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private transient Set<K> keys;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The cache for {@link #values()}.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private transient Collection<V> values;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The cache for {@link #entrySet()}.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private transient Set<Map.Entry<K, V>> entries;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class to represent an entry in the hash table. Holds a single key-value
|
|
|
|
* pair. A Hashtable Entry is identical to a HashMap Entry, except that
|
|
|
|
* `null' is not allowed for keys and values.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private static final class HashEntry<K, V>
|
|
|
|
extends AbstractMap.SimpleEntry<K, V>
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
/** The next entry in the linked list. */
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> next;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Simple constructor.
|
|
|
|
* @param key the key, already guaranteed non-null
|
|
|
|
* @param value the value, already guaranteed non-null
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry(K key, V value)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
super(key, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resets the value.
|
|
|
|
* @param newVal the new value
|
|
|
|
* @return the prior value
|
|
|
|
* @throws NullPointerException if <code>newVal</code> is null
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public V setValue(V newVal)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
if (newVal == null)
|
|
|
|
throw new NullPointerException();
|
|
|
|
return super.setValue(newVal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new Hashtable with the default capacity (11) and the default
|
|
|
|
* load factor (0.75).
|
|
|
|
*/
|
|
|
|
public Hashtable()
|
|
|
|
{
|
|
|
|
this(DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new Hashtable from the given Map, with initial capacity
|
|
|
|
* the greater of the size of <code>m</code> or the default of 11.
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* Every element in Map m will be put into this new Hashtable.
|
|
|
|
*
|
|
|
|
* @param m a Map whose key / value pairs will be put into
|
|
|
|
* the new Hashtable. <b>NOTE: key / value pairs
|
|
|
|
* are not cloned in this constructor.</b>
|
|
|
|
* @throws NullPointerException if m is null, or if m contains a mapping
|
|
|
|
* to or from `null'.
|
|
|
|
* @since 1.2
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public Hashtable(Map<? extends K, ? extends V> m)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
this(Math.max(m.size() * 2, DEFAULT_CAPACITY), DEFAULT_LOAD_FACTOR);
|
|
|
|
putAll(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new Hashtable with a specific inital capacity and
|
|
|
|
* default load factor of 0.75.
|
|
|
|
*
|
|
|
|
* @param initialCapacity the initial capacity of this Hashtable (>= 0)
|
|
|
|
* @throws IllegalArgumentException if (initialCapacity < 0)
|
|
|
|
*/
|
|
|
|
public Hashtable(int initialCapacity)
|
|
|
|
{
|
|
|
|
this(initialCapacity, DEFAULT_LOAD_FACTOR);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new Hashtable with a specific initial capacity and
|
|
|
|
* load factor.
|
|
|
|
*
|
|
|
|
* @param initialCapacity the initial capacity (>= 0)
|
|
|
|
* @param loadFactor the load factor (> 0, not NaN)
|
|
|
|
* @throws IllegalArgumentException if (initialCapacity < 0) ||
|
|
|
|
* ! (loadFactor > 0.0)
|
|
|
|
*/
|
|
|
|
public Hashtable(int initialCapacity, float loadFactor)
|
|
|
|
{
|
|
|
|
if (initialCapacity < 0)
|
|
|
|
throw new IllegalArgumentException("Illegal Capacity: "
|
|
|
|
+ initialCapacity);
|
|
|
|
if (! (loadFactor > 0)) // check for NaN too
|
|
|
|
throw new IllegalArgumentException("Illegal Load: " + loadFactor);
|
|
|
|
|
|
|
|
if (initialCapacity == 0)
|
|
|
|
initialCapacity = 1;
|
2007-01-09 19:58:05 +00:00
|
|
|
buckets = (HashEntry<K, V>[]) new HashEntry[initialCapacity];
|
2005-07-16 00:30:23 +00:00
|
|
|
this.loadFactor = loadFactor;
|
|
|
|
threshold = (int) (initialCapacity * loadFactor);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the number of key-value mappings currently in this hashtable.
|
|
|
|
* @return the size
|
|
|
|
*/
|
|
|
|
public synchronized int size()
|
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if there are no key-value mappings currently in this table.
|
|
|
|
* @return <code>size() == 0</code>
|
|
|
|
*/
|
|
|
|
public synchronized boolean isEmpty()
|
|
|
|
{
|
|
|
|
return size == 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an enumeration of the keys of this table. There's no point
|
|
|
|
* in synchronizing this, as you have already been warned that the
|
|
|
|
* enumeration is not specified to be thread-safe.
|
|
|
|
*
|
|
|
|
* @return the keys
|
|
|
|
* @see #elements()
|
|
|
|
* @see #keySet()
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public Enumeration<K> keys()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
return new KeyEnumerator();
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return an enumeration of the values of this table. There's no point
|
|
|
|
* in synchronizing this, as you have already been warned that the
|
|
|
|
* enumeration is not specified to be thread-safe.
|
|
|
|
*
|
|
|
|
* @return the values
|
|
|
|
* @see #keys()
|
|
|
|
* @see #values()
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public Enumeration<V> elements()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
return new ValueEnumerator();
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this Hashtable contains a value <code>o</code>,
|
|
|
|
* such that <code>o.equals(value)</code>. This is the same as
|
|
|
|
* <code>containsValue()</code>, and is O(n).
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* @param value the value to search for in this Hashtable
|
|
|
|
* @return true if at least one key maps to the value
|
|
|
|
* @throws NullPointerException if <code>value</code> is null
|
|
|
|
* @see #containsValue(Object)
|
|
|
|
* @see #containsKey(Object)
|
|
|
|
*/
|
|
|
|
public synchronized boolean contains(Object value)
|
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
if (value == null)
|
|
|
|
throw new NullPointerException();
|
|
|
|
|
2005-07-16 00:30:23 +00:00
|
|
|
for (int i = buckets.length - 1; i >= 0; i--)
|
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = buckets[i];
|
2005-07-16 00:30:23 +00:00
|
|
|
while (e != null)
|
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
if (e.value.equals(value))
|
2005-07-16 00:30:23 +00:00
|
|
|
return true;
|
|
|
|
e = e.next;
|
|
|
|
}
|
|
|
|
}
|
2007-01-09 19:58:05 +00:00
|
|
|
|
2005-07-16 00:30:23 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this Hashtable contains a value <code>o</code>, such that
|
|
|
|
* <code>o.equals(value)</code>. This is the new API for the old
|
|
|
|
* <code>contains()</code>.
|
|
|
|
*
|
|
|
|
* @param value the value to search for in this Hashtable
|
|
|
|
* @return true if at least one key maps to the value
|
|
|
|
* @see #contains(Object)
|
|
|
|
* @see #containsKey(Object)
|
|
|
|
* @throws NullPointerException if <code>value</code> is null
|
|
|
|
* @since 1.2
|
|
|
|
*/
|
|
|
|
public boolean containsValue(Object value)
|
|
|
|
{
|
|
|
|
// Delegate to older method to make sure code overriding it continues
|
|
|
|
// to work.
|
|
|
|
return contains(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the supplied object <code>equals()</code> a key
|
|
|
|
* in this Hashtable.
|
|
|
|
*
|
|
|
|
* @param key the key to search for in this Hashtable
|
|
|
|
* @return true if the key is in the table
|
|
|
|
* @throws NullPointerException if key is null
|
|
|
|
* @see #containsValue(Object)
|
|
|
|
*/
|
|
|
|
public synchronized boolean containsKey(Object key)
|
|
|
|
{
|
|
|
|
int idx = hash(key);
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = buckets[idx];
|
2005-07-16 00:30:23 +00:00
|
|
|
while (e != null)
|
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
if (e.key.equals(key))
|
2005-07-16 00:30:23 +00:00
|
|
|
return true;
|
|
|
|
e = e.next;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the value in this Hashtable associated with the supplied key,
|
|
|
|
* or <code>null</code> if the key maps to nothing.
|
|
|
|
*
|
|
|
|
* @param key the key for which to fetch an associated value
|
|
|
|
* @return what the key maps to, if present
|
|
|
|
* @throws NullPointerException if key is null
|
|
|
|
* @see #put(Object, Object)
|
|
|
|
* @see #containsKey(Object)
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public synchronized V get(Object key)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
int idx = hash(key);
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = buckets[idx];
|
2005-07-16 00:30:23 +00:00
|
|
|
while (e != null)
|
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
if (e.key.equals(key))
|
2005-07-16 00:30:23 +00:00
|
|
|
return e.value;
|
|
|
|
e = e.next;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Puts the supplied value into the Map, mapped by the supplied key.
|
|
|
|
* Neither parameter may be null. The value may be retrieved by any
|
|
|
|
* object which <code>equals()</code> this key.
|
|
|
|
*
|
|
|
|
* @param key the key used to locate the value
|
|
|
|
* @param value the value to be stored in the table
|
|
|
|
* @return the prior mapping of the key, or null if there was none
|
|
|
|
* @throws NullPointerException if key or value is null
|
|
|
|
* @see #get(Object)
|
|
|
|
* @see Object#equals(Object)
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public synchronized V put(K key, V value)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
int idx = hash(key);
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = buckets[idx];
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
// Check if value is null since it is not permitted.
|
|
|
|
if (value == null)
|
|
|
|
throw new NullPointerException();
|
|
|
|
|
|
|
|
while (e != null)
|
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
if (e.key.equals(key))
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
// Bypass e.setValue, since we already know value is non-null.
|
2007-01-09 19:58:05 +00:00
|
|
|
V r = e.value;
|
2005-07-16 00:30:23 +00:00
|
|
|
e.value = value;
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e = e.next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// At this point, we know we need to add a new entry.
|
|
|
|
modCount++;
|
|
|
|
if (++size > threshold)
|
|
|
|
{
|
|
|
|
rehash();
|
|
|
|
// Need a new hash value to suit the bigger table.
|
|
|
|
idx = hash(key);
|
|
|
|
}
|
|
|
|
|
2007-01-09 19:58:05 +00:00
|
|
|
e = new HashEntry<K, V>(key, value);
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
e.next = buckets[idx];
|
|
|
|
buckets[idx] = e;
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes from the table and returns the value which is mapped by the
|
|
|
|
* supplied key. If the key maps to nothing, then the table remains
|
|
|
|
* unchanged, and <code>null</code> is returned.
|
|
|
|
*
|
|
|
|
* @param key the key used to locate the value to remove
|
|
|
|
* @return whatever the key mapped to, if present
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public synchronized V remove(Object key)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
int idx = hash(key);
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = buckets[idx];
|
|
|
|
HashEntry<K, V> last = null;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
while (e != null)
|
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
if (e.key.equals(key))
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
modCount++;
|
|
|
|
if (last == null)
|
|
|
|
buckets[idx] = e.next;
|
|
|
|
else
|
|
|
|
last.next = e.next;
|
|
|
|
size--;
|
|
|
|
return e.value;
|
|
|
|
}
|
|
|
|
last = e;
|
|
|
|
e = e.next;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Copies all elements of the given map into this hashtable. However, no
|
|
|
|
* mapping can contain null as key or value. If this table already has
|
|
|
|
* a mapping for a key, the new mapping replaces the current one.
|
|
|
|
*
|
|
|
|
* @param m the map to be hashed into this
|
|
|
|
* @throws NullPointerException if m is null, or contains null keys or values
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public synchronized void putAll(Map<? extends K, ? extends V> m)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com>
* javax/management/NotificationBroadcasterSupport.java
(getNotificationInfo): Add cast.
* native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include
directories.
* native/jni/qt-peer/Makefile.in: Regenerate.
libjava/ChangeLog:
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/natFileWin32.cc (setFilePermissions): New (stub only).
_access: Handle EXEC query, stub only.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Merged from classpath:
* gnu/java/nio/SelectorProviderImpl.java: Whitespace merge.
* java/lang/System.java(inheritedChannel): New.
* java/lang/Character.java: Remove stray`;'.
* java/net/MulticastSocket.java: Merged.
* java/text/DateFormatSymbols.java(getInstance): New, comment updates.
* java/text/Collator.java(getInstance): Merged.
* java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG.
getDisplayName, getDisplayNames: New.
* java/util/logging/Logger.java: Merged.
* Regenerate .class and .h files.
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/File.java: Merge with classpath-0.95, new method
setFilePermissions, new attribute EXEC.
* java/io/natFilePosix.cc (setFilePermissions): New.
_access: Handle EXEC query.
* classpath/lib/java/io/File.class, java/io/File.h: Regenerate.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Imported GNU Classpath 0.95.
* classpath/Makefile.in,
classpath/native/jni/midi-dssi/Makefile.in,
classpath/native/jni/classpath/Makefile.in,
classpath/native/jni/Makefile.in,
classpath/native/jni/gconf-peer/Makefile.in,
classpath/native/jni/java-io/Makefile.in,
classpath/native/jni/native-lib/Makefile.in,
classpath/native/jni/java-util/Makefile.in,
classpath/native/jni/midi-alsa/Makefile.in,
classpath/native/jni/java-lang/Makefile.in,
classpath/native/jni/java-nio/Makefile.in,
classpath/native/jni/java-net/Makefile.in,
classpath/native/jni/xmlj/Makefile.in,
classpath/native/jni/qt-peer/Makefile.in,
classpath/native/jni/gtk-peer/Makefile.in,
classpath/native/Makefile.in, classpath/native/jawt/Makefile.in,
classpath/native/fdlibm/Makefile.in,
classpath/native/plugin/Makefile.in,
classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
classpath/tools/Makefile.in, classpath/doc/Makefile.in,
classpath/doc/api/Makefile.in, classpath/lib/Makefile.in,
classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in,
classpath/external/sax/Makefile.in,
classpath/external/w3c_dom/Makefile.in,
classpath/external/relaxngDatatype/Makefile.in,
classpath/include/Makefile.in,
classpath/examples/Makefile.in: Regenerate.
* classpath/config.guess, classpath/config.sub,
classpath/ltmain.sh : Update.
* classpath/configure, classpath/depcomp, classpath/missing,
classpath/aclocal.m4, classpath/install-sh: Regenerate.
* gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95.
* sources.am: Regenerate.
* Makefile.in: Regenerate.
* Update the .class files and generated CNI header files, add new
.class and generated CNI header files.
* Remove generated files for removed java source files:
classpath/gnu/java/net/BASE64.java,
classpath/gnu/java/security/util/Base64.java,
classpath/gnu/java/awt/peer/gtk/GThreadMutex.java,
classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java,
classpath/gnu/java/awt/font/autofit/Scaler.java,
classpath/gnu/classpath/jdwp/util/Value.java,
classpath/gnu/javax/net/ssl/Base64.java.
* Remove empty directories.
* Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc.
* java/lang/Class.java(setAccessible): Merge from classpath.
* java/util/Locale.java: Remove.
* gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java,
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New.
* gcj/javaprims.h: Update class declarations.
* scripts/classes.pl: Update usage.
* HACKING: Mention to build all peers.
From-SVN: r125302
2007-06-03 23:18:43 +00:00
|
|
|
final Map<K,V> addMap = (Map<K,V>) m;
|
|
|
|
final Iterator<Map.Entry<K,V>> it = addMap.entrySet().iterator();
|
|
|
|
while (it.hasNext())
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com>
* javax/management/NotificationBroadcasterSupport.java
(getNotificationInfo): Add cast.
* native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include
directories.
* native/jni/qt-peer/Makefile.in: Regenerate.
libjava/ChangeLog:
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/natFileWin32.cc (setFilePermissions): New (stub only).
_access: Handle EXEC query, stub only.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Merged from classpath:
* gnu/java/nio/SelectorProviderImpl.java: Whitespace merge.
* java/lang/System.java(inheritedChannel): New.
* java/lang/Character.java: Remove stray`;'.
* java/net/MulticastSocket.java: Merged.
* java/text/DateFormatSymbols.java(getInstance): New, comment updates.
* java/text/Collator.java(getInstance): Merged.
* java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG.
getDisplayName, getDisplayNames: New.
* java/util/logging/Logger.java: Merged.
* Regenerate .class and .h files.
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/File.java: Merge with classpath-0.95, new method
setFilePermissions, new attribute EXEC.
* java/io/natFilePosix.cc (setFilePermissions): New.
_access: Handle EXEC query.
* classpath/lib/java/io/File.class, java/io/File.h: Regenerate.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Imported GNU Classpath 0.95.
* classpath/Makefile.in,
classpath/native/jni/midi-dssi/Makefile.in,
classpath/native/jni/classpath/Makefile.in,
classpath/native/jni/Makefile.in,
classpath/native/jni/gconf-peer/Makefile.in,
classpath/native/jni/java-io/Makefile.in,
classpath/native/jni/native-lib/Makefile.in,
classpath/native/jni/java-util/Makefile.in,
classpath/native/jni/midi-alsa/Makefile.in,
classpath/native/jni/java-lang/Makefile.in,
classpath/native/jni/java-nio/Makefile.in,
classpath/native/jni/java-net/Makefile.in,
classpath/native/jni/xmlj/Makefile.in,
classpath/native/jni/qt-peer/Makefile.in,
classpath/native/jni/gtk-peer/Makefile.in,
classpath/native/Makefile.in, classpath/native/jawt/Makefile.in,
classpath/native/fdlibm/Makefile.in,
classpath/native/plugin/Makefile.in,
classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
classpath/tools/Makefile.in, classpath/doc/Makefile.in,
classpath/doc/api/Makefile.in, classpath/lib/Makefile.in,
classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in,
classpath/external/sax/Makefile.in,
classpath/external/w3c_dom/Makefile.in,
classpath/external/relaxngDatatype/Makefile.in,
classpath/include/Makefile.in,
classpath/examples/Makefile.in: Regenerate.
* classpath/config.guess, classpath/config.sub,
classpath/ltmain.sh : Update.
* classpath/configure, classpath/depcomp, classpath/missing,
classpath/aclocal.m4, classpath/install-sh: Regenerate.
* gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95.
* sources.am: Regenerate.
* Makefile.in: Regenerate.
* Update the .class files and generated CNI header files, add new
.class and generated CNI header files.
* Remove generated files for removed java source files:
classpath/gnu/java/net/BASE64.java,
classpath/gnu/java/security/util/Base64.java,
classpath/gnu/java/awt/peer/gtk/GThreadMutex.java,
classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java,
classpath/gnu/java/awt/font/autofit/Scaler.java,
classpath/gnu/classpath/jdwp/util/Value.java,
classpath/gnu/javax/net/ssl/Base64.java.
* Remove empty directories.
* Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc.
* java/lang/Class.java(setAccessible): Merge from classpath.
* java/util/Locale.java: Remove.
* gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java,
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New.
* gcj/javaprims.h: Update class declarations.
* scripts/classes.pl: Update usage.
* HACKING: Mention to build all peers.
From-SVN: r125302
2007-06-03 23:18:43 +00:00
|
|
|
final Map.Entry<K,V> e = it.next();
|
2005-07-16 00:30:23 +00:00
|
|
|
// Optimize in case the Entry is one of our own.
|
2007-01-09 19:58:05 +00:00
|
|
|
if (e instanceof AbstractMap.SimpleEntry)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
AbstractMap.SimpleEntry<? extends K, ? extends V> entry
|
|
|
|
= (AbstractMap.SimpleEntry<? extends K, ? extends V>) e;
|
2005-07-16 00:30:23 +00:00
|
|
|
put(entry.key, entry.value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
put(e.getKey(), e.getValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears the hashtable so it has no keys. This is O(1).
|
|
|
|
*/
|
|
|
|
public synchronized void clear()
|
|
|
|
{
|
|
|
|
if (size > 0)
|
|
|
|
{
|
|
|
|
modCount++;
|
|
|
|
Arrays.fill(buckets, null);
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a shallow clone of this Hashtable. The Map itself is cloned,
|
|
|
|
* but its contents are not. This is O(n).
|
|
|
|
*
|
|
|
|
* @return the clone
|
|
|
|
*/
|
|
|
|
public synchronized Object clone()
|
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
Hashtable<K, V> copy = null;
|
2005-07-16 00:30:23 +00:00
|
|
|
try
|
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
copy = (Hashtable<K, V>) super.clone();
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
catch (CloneNotSupportedException x)
|
|
|
|
{
|
|
|
|
// This is impossible.
|
|
|
|
}
|
2007-01-09 19:58:05 +00:00
|
|
|
copy.buckets = (HashEntry<K, V>[]) new HashEntry[buckets.length];
|
2005-07-16 00:30:23 +00:00
|
|
|
copy.putAllInternal(this);
|
|
|
|
// Clear the caches.
|
|
|
|
copy.keys = null;
|
|
|
|
copy.values = null;
|
|
|
|
copy.entries = null;
|
|
|
|
return copy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Converts this Hashtable to a String, surrounded by braces, and with
|
|
|
|
* key/value pairs listed with an equals sign between, separated by a
|
|
|
|
* comma and space. For example, <code>"{a=1, b=2}"</code>.<p>
|
|
|
|
*
|
|
|
|
* NOTE: if the <code>toString()</code> method of any key or value
|
|
|
|
* throws an exception, this will fail for the same reason.
|
|
|
|
*
|
|
|
|
* @return the string representation
|
|
|
|
*/
|
|
|
|
public synchronized String toString()
|
|
|
|
{
|
|
|
|
// Since we are already synchronized, and entrySet().iterator()
|
|
|
|
// would repeatedly re-lock/release the monitor, we directly use the
|
2006-01-17 18:09:40 +00:00
|
|
|
// unsynchronized EntryIterator instead.
|
2007-01-09 19:58:05 +00:00
|
|
|
Iterator<Map.Entry<K, V>> entries = new EntryIterator();
|
re PR libgcj/37636 (java tools are unable to find resource files)
libjava/ChangeLog:
2008-10-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
* sources.am, Makfile.in: Regenerate.
2008-10-17 Matthias Klose <doko@ubuntu.com>
* configure.ac: Fix bashisms.
* configure: Regenerate.
2008-10-15 Matthias Klose <doko@ubuntu.com>
* configure.ac: Disable build of gjdoc, if configured without
--with-antlr-jar or if no antlr.jar found.
* configure: Regenerate.
2008-10-09 Andrew John Hughes <gnu_andrew@member.fsf.org>
* classpath/configure.ac,
* classpath/m4/ac_prog_antlr.m4,
* classpath/m4/ac_prog_java.m4,
* classpath/tools/Makefile.am:
Ported --regen-gjdoc-parser patch and
cantlr support from GNU Classpath.
2008-10-06 Andrew Haley <aph@redhat.com>
* java/lang/Thread.java (Thread): Always create the ThreadLocalMap
when creating a thread.
(getThreadLocals) Don't lazily create the ThreadLocalMap.
2008-09-28 Andrew John Hughes <gnu_andrew@member.fsf.org>
* classpath/java/lang/ThreadLocalMap.java,
* java/lang/ThreadLocalMap$Entry.h,
* java/lang/ThreadLocalMap.h,
* lib/java/lang/ThreadLocalMap.class,
* lib/java/lang/ThreadLocalMap$Entry.class:
Add the new files for the ThreadLocal patch.
2008-09-28 Andrew John Hughes <gnu_andrew@member.fsf.org>
* classpath/ChangeLog,
* classpath/java/lang/InheritableThreadLocal.java,
* classpath/java/lang/Thread.java,
* classpath/java/lang/ThreadLocal.java:
Merge Daniel Frampton's ThreadLocal patch.
* gcj/javaprims.h: Updated.
* java/lang/Thread.h: Regenerated.
* java/lang/Thread.java:
Replace WeakIdentityHashMap with ThreadLocalMap.
(getThreadLocals()): Likewise.
* java/lang/ThreadLocal.h: Regenerated.
* java/lang/ThreadLocal.java:
(computeNextHash()): New method.
(ThreadLocal()): Initialise fastHash.
(internalGet()): Updated to match Classpath's get().
(internalSet(Object)): Likewise for set(Object).
(internalRemove()): Likewise for remove().
2008-09-25 Andrew John Hughes <gnu_andrew@member.fsf.org>
* classpath/configure,
* classpath/configure.ac:
Resynchronise with Classpath's configure.
* classpath/examples/Makefile.in:
Add equivalent support for building as in
tools/Makefile.in.
* classpath/java/nio/Buffer.java,
* classpath/java/nio/ByteBuffer.java,
* classpath/java/nio/ByteBufferImpl.java,
* classpath/java/nio/CharBuffer.java,
* classpath/java/nio/CharBufferImpl.java,
* classpath/java/nio/CharSequenceBuffer.java,
* classpath/java/nio/CharViewBufferImpl.java,
* classpath/java/nio/DirectByteBufferImpl.java,
* classpath/java/nio/DoubleBuffer.java,
* classpath/java/nio/DoubleBufferImpl.java,
* classpath/java/nio/DoubleViewBufferImpl.java,
* classpath/java/nio/FloatBuffer.java,
* classpath/java/nio/FloatBufferImpl.java,
* classpath/java/nio/FloatViewBufferImpl.java,
* classpath/java/nio/IntBuffer.java,
* classpath/java/nio/IntBufferImpl.java,
* classpath/java/nio/IntViewBufferImpl.java,
* classpath/java/nio/LongBuffer.java,
* classpath/java/nio/LongBufferImpl.java,
* classpath/java/nio/LongViewBufferImpl.java,
* classpath/java/nio/MappedByteBuffer.java,
* classpath/java/nio/MappedByteBufferImpl.java,
* classpath/java/nio/ShortBuffer.java,
* classpath/java/nio/ShortBufferImpl.java,
* classpath/java/nio/ShortViewBufferImpl.java:
Replace use of gnu.classpath.Pointer with gnu.gcj.RawData,
and fix some formatting issues.
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaLexer.java,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaLexer.smap,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaRecognizer.java,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaRecognizer.smap,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaTokenTypes.java,
* classpath/tools/gnu/classpath/tools/gjdoc/expr/JavaTokenTypes.txt:
Regenerated (later version of antlr).
* java/nio/Buffer.h: Regenerated.
* java/nio/Buffer.java: Ported changes from Classpath.
* java/nio/ByteBuffer.h,
* java/nio/CharBuffer.h: Regenerated.
* java/nio/DirectByteBufferImpl.java: Ported changes from
Classpath.
* java/nio/DoubleBuffer.h,
* java/nio/FloatBuffer.h,
* java/nio/IntBuffer.h,
* java/nio/LongBuffer.h,
* java/nio/MappedByteBuffer.h,
* java/nio/MappedByteBufferImpl.h: Regenerated.
* java/nio/MappedByteBufferImpl.java: Ported changes from
Classpath.
* java/nio/ShortBuffer.h: Regenerated.
2008-09-24 Matthias Klose <doko@ubuntu.com>
* configure.ac: Search for antlr.jar, if not configured.
* configure: Regenerate.
2008-09-24 Matthias Klose <doko@ubuntu.com>
* Makefile.am: Build a gjdoc binary, if enabled.
* configure.ac: Add options --disable-gjdoc, --with-antlr-jar=file.
* Makefile.in, */Makefile.in, configure: Regenerate.
2008-09-22 Andrew Haley <aph@redhat.com>
* java/lang/String.java (toString(char[], int, int)): New method.
2008-09-14 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (libgcj-import-20080914).
* Regenerate class and header files.
* Regenerate auto* files.
* configure.ac: Don't pass --disable-gjdoc to classpath.
* sources.am: Regenerated.
* HACKING: Mention to build gjdoc in maintainer builds.
* gnu/classpath/Configuration.java: Update classpath version.
* gcj/javaprims.h: Update.
2008-09-08 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Makefile.am: Replace natStringBuffer.cc
and natStringBuilder.cc with natAbstractStringBuffer.cc.
* Makefile.in: Regenerated.
* java/lang/AbstractStringBuffer.java:
(append(int)): Made native.
(regionMatches(int,String)): Likewise.
* java/lang/StringBuffer.h: Regenerated.
* java/lang/StringBuffer.java: Remerged with GNU Classpath.
* java/lang/StringBuilder.h: Regenerated.
* java/lang/StringBuilder.java: Remerged with GNU Classpath.
* java/lang/natAbstractStringBuffer.cc: Provide common
native methods for StringBuffer and StringBuilder.
* java/lang/natStringBuffer.cc,
* java/lang/natStringBuilder.cc: Removed.
2008-09-04 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Makefile.in,
* classpath/configure: Regenerated.
* gnu/gcj/util/natDebug.cc,
* gnu/gcj/xlib/natColormap.cc,
* gnu/gcj/xlib/natDisplay.cc,
* gnu/gcj/xlib/natDrawable.cc,
* gnu/gcj/xlib/natFont.cc,
* gnu/gcj/xlib/natWMSizeHints.cc,
* gnu/gcj/xlib/natWindow.cc,
* gnu/gcj/xlib/natXImage.cc:
Add :: prefix to namespaces.
* java/io/CharArrayWriter.h,
* java/lang/StringBuffer.h:
Regenerated using patched gjavah.
* java/lang/natStringBuffer.cc:
Fix naming of append(jint).
* java/sql/Timestamp.h: Regenerated
using patched gjavah.
* jni.cc: Rename p to functions
to match change in GNU Classpath.
* scripts/makemake.tcl: Switch
gnu.java.math to BC compilation.
* sources.am: Regenerated.
2008-08-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Makefile.in: Updated location of Configuration.java.
* classpath/lib/gnu/java/locale/LocaleData.class: Regenerated.
2008-08-18 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Makefile.in: Updated with new Java files.
* classpath/configure: Regenerated.
* classpath/tools/Makefile.am: Add missing
use of GJDOC_EX so --disable-gjdoc works.
* classpath/tools/Makefile.in: Regenerated.
2008-08-15 Matthias Klose <doko@ubuntu.com>
Import GNU Classpath (libgcj-import-20080811).
* Regenerate class and header files.
* Regenerate auto* files.
* configure.ac: Don't pass --with-fastjar to classpath, substitute new
dummy value in classpath/gnu/classpath/Configuration.java.in, pass
--disable-gjdoc to classpath.
* scripts/makemake.tcl:
* sources.am: Regenerated.
* java/lang/AbstractStringBuffer.java, gnu/java/lang/VMCPStringBuilder.java:
New, copied from classpath, use System instead of VMSystem.
* java/lang/StringBuffer.java: Merge from classpath.
* java/lang/ClassLoader.java: Merge from classpath.
* gcj/javaprims.h: Update class definitions,
remove _Jv_jobjectRefType, jobjectRefType definitions.
libjava/classpath/ChangeLog.gcj:
2008-10-21 Matthias Klose <doko@ubuntu.com>
* classpath/tools/gnu/classpath/tools/gjdoc/expr/Java*: Move from ...
* classpath/tools/generated/gnu/classpath/tools/gjdoc/expr/ ... here.
* Update .class files.
2008-10-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/Makefile.am:
Always generate parser in the srcdir.
2008-10-21 Matthias Klose <doko@ubuntu.com>
* doc/Makefile.am (MAINTAINERCLEANFILES): Add gjdoc.1.
* doc/Makefile.in: Regenerate.
2008-10-20 Matthias Klose <doko@ubuntu.com>
* configure.ac: Don't check for working java, if not configured
with --enable-java-maintainer-mode.
* configure: Regenerate.
2008-10-19 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_java.m4: Revert previous change.
* m4/ac_prog_javac.m4: Apply it here.
* configure: Regenerate.
2008-10-19 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_javac.m4: Don't check for working javac, if not configured
with --enable-java-maintainer-mode.
* configure: Regenerate.
* Makefile.in, */Makefile.in: Regenerate.
2008-09-30 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_antlr.m4: Check for cantlr binary as well.
2008-09-29 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_antlr.m4: Check for antlr binary as well.
2008-09-28 Matthias Klose <doko@ubuntu.com>
* PR libgcj/37636. Revert:
2008-02-20 Matthias Klose <doko@ubuntu.com>
* tools/Makefile.am ($(TOOLS_ZIP)): Revert part of previous change,
Do copy resource files in JAVA_MAINTAINER_MODE only.
* tools/Makefile.in: Regenerate.
2008-09-14 Matthias Klose <doko@ubuntu.com>
* m4/ac_prog_javac_works.m4, m4/ac_prog_javac.m4, m4/acinclude.m4:
Revert local changes.
* m4/ac_prog_antlr.m4: Check for an runantlr binary.
* tools/Makefile.am, lib/Makefile.am: Revert local changes (JCOMPILER).
* tools/Makefile.am: Remove USE_JAVAC_FLAGS, pass ANTLR_JAR in
GLIBJ_CLASSPATH.
2008-09-14 Matthias Klose <doko@ubuntu.com>
Revert:
Daniel Frampton <zyridium at zyridium.net>
* AUTHORS: Added.
* java/lang/InheritableThreadLocal.java,
* java/lang/Thread.java,
* java/lang/ThreadLocal.java:
Modified to use java.lang.ThreadLocalMap.
* java/lang/ThreadLocalMap.java:
New cheaper ThreadLocal-specific WeakHashMap.
2008-08-15 Matthias Klose <doko@ubuntu.com>
* m4/acinclude.m4 (CLASSPATH_JAVAC_MEM_CHECK): Remove unknown
args for javac.
libjava/classpath/ChangeLog:
2008-10-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* m4/ac_prog_antlr.m4:
Remove redundant checks.
* tools/Makefile.am:
Use gjdoc_gendir when calling antlr.
2008-10-15 Andrew John Hughes <gnu_andrew@member.fsf.org>
* configure.ac:
Remove superfluous AC_PROG_JAVA call.
2008-10-06 Andrew John Hughes <gnu_andrew@member.fsf.org>
* m4/ac_prog_antlr:
Check for cantlr as well.
* tools/Makefile.am:
Only build GJDoc parser when both
CREATE_GJDOC and CREATE_GJDOC_PARSER
are on.
2008-10-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
* configure.ac:
Add regen-gjdoc-parser option,
and separate antlr tests.
* m4/ac_prog_antlr.m4:
Turn single test into AC_LIB_ANTLR
and AC_PROG_ANTLR.
* m4/ac_prog_java.m4:
Quote tests.
* tools/Makefile.am:
Support CREATE_GJDOC_PARSER option.
2008-09-14 Andrew John Hughes <gnu_andrew@member.fsf.org>
* examples/Makefile.am:
Check lib directly as well as glibj.zip
for boot classes.
* m4/acinclude.m4:
Only require the class files to be built
to allow the tools and examples to be built,
not the installation of glibj.zip.
* tools/Makefile.am:
Check lib directly as well as glibj.zip
for boot classes.
2008-09-13 Andrew John Hughes <gnu_andrew@member.fsf.org>
* examples/Makefile.am,
* lib/Makefile.am:
Add GCJ rules.
* m4/ac_prog_javac.m4:
Check whether JAVAC is gcj.
* m4/ac_prog_javac_works.m4:
Add GCJ rules.
* m4/acinclude.m4:
Don't bother checking for -J
if using GCJ.
* tools/Makefile.am:
Add GCJ rules.
2007-08-23 Daniel Frampton <zyridium@zyridium.net>
* AUTHORS: Added.
* java/lang/InheritableThreadLocal.java,
* java/lang/Thread.java,
* java/lang/ThreadLocal.java:
Modified to use java.lang.ThreadLocalMap.
* java/lang/ThreadLocalMap.java:
New cheaper ThreadLocal-specific WeakHashMap.
2008-02-07 Ian Rogers <ian.rogers@manchester.ac.uk>
* java/util/zip/ZipEntry.java:
Use byte fields instead of integer fields,
store the time as well as the DOS time and
don't retain a global Calendar instance.
(setDOSTime(int)): Set KNOWN_DOSTIME instead
of KNOWN_TIME, and unset KNOWN_TIME.
(getDOSTime()): Compute DOS time from UNIX time
only when needed.
(clone()): Provide cloning via the ZipEntry constructor
where possible.
(setTime(long)): Don't compute DOS time at this point.
(getCalendar()): Removed.
2008-09-09 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/gnu/classpath/tools/getopt/Parser.java:
(setHeader(String)): Make synchronized.
(setFooter(String)): Likewise.
* tools/gnu/classpath/tools/rmic/SourceGiopRmicCompiler.java,
(reset()): Make synchronized.
(name(Class)): Likewise.
2008-09-04 Robert Schuster <robertschuster@fsfe.org>
* gnu/java/nio/charset/ByteDecodeLoopHelper:
(arrayDecodeLoop): Added new break label, escape to that label.
* gnu/java/nio/charset/ByteEncodeLoopHelper:
(arrayDecodeLoop): Added new break label, escape to that label.
2008-09-04 Robert Schuster <robertschuster@fsfe.org>
* java/text/DecimalFormat.java:
(scanFix): Use 'i + 1' when looking at following character.
(scanNegativePattern): Dito.
2008-09-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/gnu/classpath/tools/javah/ClassWrapper.java:
(makeVtable()): Populate methodNameMap.
(printMethods(CniPrintStream)): Always use pre-populated
methodNameMap for bridge targets.
2008-09-01 Mario Torre <neugens@aicas.com>
* gnu/java/awt/peer/x/XImage.java (XImageProducer): remove @Override
annotation to allow compilation on javac < 1.6 and ecj < 3.4.
2008-09-01 Mario Torre <neugens@aicas.com>
* gnu/java/awt/peer/x/XGraphicsDevice.java (getDisplay): fix to support
new Escher API.
* gnu/java/awt/peer/x/XImage.java (getSource): method implemented.
* gnu/java/awt/peer/x/XImage.java (XImageProducer): implement ImageProducer
for getSource.
2008-09-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/java/util/regex/BacktrackStack.java,
* gnu/java/util/regex/CharIndexed.java,
* gnu/java/util/regex/CharIndexedCharArray.java,
* gnu/java/util/regex/CharIndexedCharSequence.java,
* gnu/java/util/regex/CharIndexedInputStream.java,
* gnu/java/util/regex/CharIndexedString.java,
* gnu/java/util/regex/CharIndexedStringBuffer.java,
* gnu/java/util/regex/RE.java,
* gnu/java/util/regex/REException.java,
* gnu/java/util/regex/REFilterInputStream.java,
* gnu/java/util/regex/REMatch.java,
* gnu/java/util/regex/REMatchEnumeration.java,
* gnu/java/util/regex/RESyntax.java,
* gnu/java/util/regex/REToken.java,
* gnu/java/util/regex/RETokenAny.java,
* gnu/java/util/regex/RETokenBackRef.java,
* gnu/java/util/regex/RETokenChar.java,
* gnu/java/util/regex/RETokenEnd.java,
* gnu/java/util/regex/RETokenEndOfPreviousMatch.java,
* gnu/java/util/regex/RETokenEndSub.java,
* gnu/java/util/regex/RETokenIndependent.java,
* gnu/java/util/regex/RETokenLookAhead.java,
* gnu/java/util/regex/RETokenLookBehind.java,
* gnu/java/util/regex/RETokenNamedProperty.java,
* gnu/java/util/regex/RETokenOneOf.java,
* gnu/java/util/regex/RETokenPOSIX.java,
* gnu/java/util/regex/RETokenRange.java,
* gnu/java/util/regex/RETokenRepeated.java,
* gnu/java/util/regex/RETokenStart.java,
* gnu/java/util/regex/RETokenWordBoundary.java,
* gnu/java/util/regex/UncheckedRE.java:
Fix indentation.
2008-09-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/java/util/regex/RETokenStart.java:
(getMaximumLength()): Add Override annotation.
(matchThis(CharIndexed, REMatch)): Likewise.
(returnsFixedLengthMatches()): Renamed from
returnsFixedLengthmatches and added Override
annotation.
(findFixedLengthMatches(CharIndexed,REMatch,int)):
Add Override annotation.
(dump(CPStringBuilder)): Likewise.
* gnu/javax/print/ipp/IppRequest.java:
(RequestWriter.writeOperationAttributes(AttributeSet)):
Throw exception, don't just create and drop it.
* javax/management/MBeanServerPermission.java:
(MBeanServerPermissionCollection.add(Permission)): Compare
against individual Strings not the entire array, and
store the result of replace.
* javax/swing/text/html/StyleSheet.java:
(setBaseFontSize(size)): Store result of trim().
2008-09-01 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/tools/FileObject.java:
(openReader(boolean)): Document new parameter.
2008-03-27 Michael Franz <mvfranz@gmail.com>
PR classpath/35690:
* javax/tools/FileObject.java:
(toUri()): Fix case from toURI.
(openReader(boolean)): Add missing boolean argument.
2008-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/35487:
* gnu/javax/management/Server.java:
(beans): Change to ConcurrentHashMap.
(defaultDomain): Make final.
(outer): Likewise.
(LazyListenersHolder): Added to wrap
listeners, also now a ConcurrentHashMap,
providing lazy initialisation safely.
(sequenceNumber): Documented.
(getBean(ObjectName)): Remove redundant cast.
(addNotificationListener(ObjectName,NotificationListener,
NotificationFilter,Object)): Remove map initialisation
and use holder.
(getObjectInstance(ObjectName)): Remove redundant cast.
(registerMBean(Object,ObjectName)): Add bean atomically.
(removeNotificationListener(ObjectName,NotificationListener)):
Simplified.
(removeNotificationListener(ObjectName,NotificationListener,
NotificationFilter,Object)): Likewise.
(notify(ObjectName,String)): Documented.
2008-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/javax/management/Server.java:
Genericised.
2008-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/javax/management/Translator.java:
Genericised.
2008-08-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/DefaultLoaderRepository.java,
* javax/management/JMX.java,
* javax/management/MBeanAttributeInfo.java,
* javax/management/MBeanConstructorInfo.java,
* javax/management/MBeanOperationInfo.java,
* javax/management/MBeanServerDelegate.java:
Fix warnings due to generics.
2008-08-25 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/MBeanPermission.java,
* javax/management/MBeanServerDelegate.java,
* javax/management/MBeanServerFactory.java,
* javax/management/MBeanServerInvocationHandler.java,
* javax/management/MBeanServerPermission.java:
Fix warnings due to use of non-generic collections.
2008-08-25 Mario Torre <neugens@aicas.com>
* gnu/javax/rmi/CORBA/RmiUtilities.java (readValue): check if sender is
null to avoid NPE.
2008-08-22 Mario Torre <neugens@aicas.com>
* gnu/CORBA/OrbFunctional.java (set_parameters): Fix
NullPointerException checking when param is null.
2008-08-23 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/util/regex/Matcher.java:
(reset()): Reset append position so
we don't try and append to the end of
the old input.
2008-08-22 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/32028:
* m4/acinclude.m4:
Also allow versions of GJDoc from 0.8* on, as
CVS is 0.8.0-pre.
2008-08-21 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/32028:
* m4/acinclude.m4:
(CLASSPATH_WITH_GJDOC): Ensure version 0.7.9 is
being used.
2008-08-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
* tools/Makefile.am:
Add taglets subdirectory to list of excluded
paths when GJDoc is not compiled.
2008-08-19 David P Grove <groved@us.ibm.com>
* scripts/check_jni_methods.sh.in:
Fix build issue on AIX by splitting generation
of method list.
2008-08-18 Andrew John Hughes <gnu_andrew@member.fsf.org>
* native/jni/gstreamer-peer/gst_native_pipeline.c:
(get_free_space(int)): Use #else not #elif when
there is no condition.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/31895:
* java/text/DecimalFormat.java:
(setCurrency(Currency)): Update prefixes and
suffixes when currency changes.
* java/text/DecimalFormatSymbols.java:
(DecimalFormatSymbols(Locale)): Set locale earlier
so it can be used by setCurrency(Currency).
(setCurrency(Currency)): Set the symbol correctly using
the locale of the instance.
* java/util/Currency.java:
Throw error instead of just printing a message.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/activation/ActivationDataFlavor.java:
Suppress warnings from public API.
(mimeType): Made final.
(representationClass): Added generic type and
made final.
(normalizeMimeTypeParameter(String,String)):
Use CPStringBuilder.
* javax/activation/CommandInfo.java:
(verb): Made final.
(className): Made final.
* javax/activation/DataHandler.java:
(dataSource): Made final.
* javax/activation/FileDataSource.java:
(file): Made final.
* javax/activation/MailcapCommandMap.java:
Use generics on collections and CPStringBuilder
instead of StringBuffer.
* javax/activation/MimeType.java:
(toString()): Use CPStringBuilder.
(getBaseType()): Likewise.
* javax/activation/MimeTypeParameterList.java:
Use generics on collections and CPStringBuilder
instead of StringBuffer.
* javax/activation/MimeTypeParseException.java:
(MimeTypeParseException(String,String)): Use
CPStringBuilder.
* javax/activation/MimetypesFileTypeMap.java:
Use generics on collections and CPStringBuilder
instead of StringBuffer.
* javax/activation/URLDataSource.java:
(url): Made final.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* gnu/javax/activation/viewers/ImageViewer.java,
* gnu/javax/activation/viewers/TextEditor.java,
* gnu/javax/activation/viewers/TextViewer.java,
* javax/activation/ActivationDataFlavor.java,
* javax/activation/CommandInfo.java,
* javax/activation/CommandMap.java,
* javax/activation/CommandObject.java,
* javax/activation/DataContentHandler.java,
* javax/activation/DataContentHandlerFactory.java,
* javax/activation/DataHandler.java,
* javax/activation/DataHandlerDataSource.java,
* javax/activation/DataSource.java,
* javax/activation/DataSourceDataContentHandler.java,
* javax/activation/FileDataSource.java,
* javax/activation/FileTypeMap.java,
* javax/activation/MailcapCommandMap.java,
* javax/activation/MimeType.java,
* javax/activation/MimeTypeParameterList.java,
* javax/activation/MimeTypeParseException.java,
* javax/activation/MimetypesFileTypeMap.java,
* javax/activation/ObjectDataContentHandler.java,
* javax/activation/URLDataSource.java,
* javax/activation/UnsupportedDataTypeException.java,
* javax/activation/package.html,
* resource/META-INF/mailcap.default,
* resource/META-INF/mimetypes.default:
Import GNU JAF CVS as of 17/08/2008.
2006-04-25 Archit Shah <ashah@redhat.com>
* javax/activation/MimeTypeParameterList.java:
Insert ';' separator before parameter list.
2005-06-29 Xavier Poinsard <xpoinsard@openpricer.com>
* javax/activation/ObjectDataContentHandler.java:
Fixed typo.
2005-05-28 Chris Burdess <dog@bluezoo.org>
* javax/activation/CommandMap.java,
* javax/activation/MailcapCommandMap.java:
Updated to JAF 1.1.
2004-06-09 Chris Burdess <dog@bluezoo.org>
* javax/activation/MailcapCommandMap.java:
Fixed bug whereby x-java prefix was not
attempted.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* AUTHORS: Added Laszlo.
2008-04-20 Andrew John Hughes <gnu_andrew@member.fsf.org>
PR classpath/30436:
* java/util/Scanner.java:
Fix package to be java.util and correct
indentation.
2007-07-25 Laszlo Andras Hernadi <e0327023@student.tuwien.ac.at>
PR classpath/30436:
* java/util/Scanner.java:
Initial implementation.
2008-08-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/util/regex/Matcher.java:
(toMatchResult()): Implemented.
2008-08-13 Joshua Sumali <jsumali@redhat.com>
* doc/Makefile.am (gjdoc.pod): Generate gjdoc pod from cp-tools.texinfo
instead of invoke.texi. Remove invoke.texi from EXTRA_DIST.
* doc/invoke.texi: Removed and merged into ...
* doc/cp-tools.texinfo: Here
2008-08-12 Robert Schuster <robertschuster@fsfe.org>
* native/jni/java-net/local.c
(local_bind): Removed fprintf call, fixed access outside
of array bounds.
From-SVN: r141271
2008-10-21 17:55:01 +00:00
|
|
|
CPStringBuilder r = new CPStringBuilder("{");
|
2005-07-16 00:30:23 +00:00
|
|
|
for (int pos = size; pos > 0; pos--)
|
|
|
|
{
|
|
|
|
r.append(entries.next());
|
|
|
|
if (pos > 1)
|
|
|
|
r.append(", ");
|
|
|
|
}
|
|
|
|
r.append("}");
|
|
|
|
return r.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a "set view" of this Hashtable's keys. The set is backed by
|
|
|
|
* the hashtable, so changes in one show up in the other. The set supports
|
|
|
|
* element removal, but not element addition. The set is properly
|
|
|
|
* synchronized on the original hashtable. Sun has not documented the
|
|
|
|
* proper interaction of null with this set, but has inconsistent behavior
|
|
|
|
* in the JDK. Therefore, in this implementation, contains, remove,
|
|
|
|
* containsAll, retainAll, removeAll, and equals just ignore a null key
|
|
|
|
* rather than throwing a {@link NullPointerException}.
|
|
|
|
*
|
|
|
|
* @return a set view of the keys
|
|
|
|
* @see #values()
|
|
|
|
* @see #entrySet()
|
|
|
|
* @since 1.2
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public Set<K> keySet()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
if (keys == null)
|
|
|
|
{
|
|
|
|
// Create a synchronized AbstractSet with custom implementations of
|
|
|
|
// those methods that can be overridden easily and efficiently.
|
2007-01-09 19:58:05 +00:00
|
|
|
Set<K> r = new AbstractSet<K>()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
public int size()
|
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2007-01-09 19:58:05 +00:00
|
|
|
public Iterator<K> iterator()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
return new KeyIterator();
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void clear()
|
|
|
|
{
|
|
|
|
Hashtable.this.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean contains(Object o)
|
|
|
|
{
|
|
|
|
if (o == null)
|
|
|
|
return false;
|
|
|
|
return containsKey(o);
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean remove(Object o)
|
|
|
|
{
|
|
|
|
return Hashtable.this.remove(o) != null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
// We must specify the correct object to synchronize upon, hence the
|
|
|
|
// use of a non-public API
|
2007-01-09 19:58:05 +00:00
|
|
|
keys = new Collections.SynchronizedSet<K>(this, r);
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
return keys;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a "collection view" (or "bag view") of this Hashtable's values.
|
|
|
|
* The collection is backed by the hashtable, so changes in one show up
|
|
|
|
* in the other. The collection supports element removal, but not element
|
|
|
|
* addition. The collection is properly synchronized on the original
|
|
|
|
* hashtable. Sun has not documented the proper interaction of null with
|
|
|
|
* this set, but has inconsistent behavior in the JDK. Therefore, in this
|
|
|
|
* implementation, contains, remove, containsAll, retainAll, removeAll, and
|
|
|
|
* equals just ignore a null value rather than throwing a
|
|
|
|
* {@link NullPointerException}.
|
|
|
|
*
|
|
|
|
* @return a bag view of the values
|
|
|
|
* @see #keySet()
|
|
|
|
* @see #entrySet()
|
|
|
|
* @since 1.2
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public Collection<V> values()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
if (values == null)
|
|
|
|
{
|
|
|
|
// We don't bother overriding many of the optional methods, as doing so
|
|
|
|
// wouldn't provide any significant performance advantage.
|
2007-01-09 19:58:05 +00:00
|
|
|
Collection<V> r = new AbstractCollection<V>()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
public int size()
|
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2007-01-09 19:58:05 +00:00
|
|
|
public Iterator<V> iterator()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
return new ValueIterator();
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void clear()
|
|
|
|
{
|
|
|
|
Hashtable.this.clear();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
// We must specify the correct object to synchronize upon, hence the
|
|
|
|
// use of a non-public API
|
2007-01-09 19:58:05 +00:00
|
|
|
values = new Collections.SynchronizedCollection<V>(this, r);
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
return values;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns a "set view" of this Hashtable's entries. The set is backed by
|
|
|
|
* the hashtable, so changes in one show up in the other. The set supports
|
|
|
|
* element removal, but not element addition. The set is properly
|
|
|
|
* synchronized on the original hashtable. Sun has not documented the
|
|
|
|
* proper interaction of null with this set, but has inconsistent behavior
|
|
|
|
* in the JDK. Therefore, in this implementation, contains, remove,
|
|
|
|
* containsAll, retainAll, removeAll, and equals just ignore a null entry,
|
|
|
|
* or an entry with a null key or value, rather than throwing a
|
|
|
|
* {@link NullPointerException}. However, calling entry.setValue(null)
|
|
|
|
* will fail.
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* Note that the iterators for all three views, from keySet(), entrySet(),
|
|
|
|
* and values(), traverse the hashtable in the same sequence.
|
|
|
|
*
|
|
|
|
* @return a set view of the entries
|
|
|
|
* @see #keySet()
|
|
|
|
* @see #values()
|
|
|
|
* @see Map.Entry
|
|
|
|
* @since 1.2
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public Set<Map.Entry<K, V>> entrySet()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
if (entries == null)
|
|
|
|
{
|
|
|
|
// Create an AbstractSet with custom implementations of those methods
|
|
|
|
// that can be overridden easily and efficiently.
|
2007-01-09 19:58:05 +00:00
|
|
|
Set<Map.Entry<K, V>> r = new AbstractSet<Map.Entry<K, V>>()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
public int size()
|
|
|
|
{
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2007-01-09 19:58:05 +00:00
|
|
|
public Iterator<Map.Entry<K, V>> iterator()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
return new EntryIterator();
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public void clear()
|
|
|
|
{
|
|
|
|
Hashtable.this.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean contains(Object o)
|
|
|
|
{
|
|
|
|
return getEntry(o) != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean remove(Object o)
|
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = getEntry(o);
|
2005-07-16 00:30:23 +00:00
|
|
|
if (e != null)
|
|
|
|
{
|
|
|
|
Hashtable.this.remove(e.key);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
// We must specify the correct object to synchronize upon, hence the
|
|
|
|
// use of a non-public API
|
2007-01-09 19:58:05 +00:00
|
|
|
entries = new Collections.SynchronizedSet<Map.Entry<K, V>>(this, r);
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
return entries;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this Hashtable equals the supplied Object <code>o</code>.
|
|
|
|
* As specified by Map, this is:
|
|
|
|
* <code>
|
|
|
|
* (o instanceof Map) && entrySet().equals(((Map) o).entrySet());
|
|
|
|
* </code>
|
|
|
|
*
|
|
|
|
* @param o the object to compare to
|
|
|
|
* @return true if o is an equal map
|
|
|
|
* @since 1.2
|
|
|
|
*/
|
|
|
|
public boolean equals(Object o)
|
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
// no need to synchronize, entrySet().equals() does that.
|
2005-07-16 00:30:23 +00:00
|
|
|
if (o == this)
|
|
|
|
return true;
|
|
|
|
if (!(o instanceof Map))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return entrySet().equals(((Map) o).entrySet());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the hashCode for this Hashtable. As specified by Map, this is
|
|
|
|
* the sum of the hashCodes of all of its Map.Entry objects
|
|
|
|
*
|
|
|
|
* @return the sum of the hashcodes of the entries
|
|
|
|
* @since 1.2
|
|
|
|
*/
|
|
|
|
public synchronized int hashCode()
|
|
|
|
{
|
|
|
|
// Since we are already synchronized, and entrySet().iterator()
|
|
|
|
// would repeatedly re-lock/release the monitor, we directly use the
|
2006-01-17 18:09:40 +00:00
|
|
|
// unsynchronized EntryIterator instead.
|
2007-01-09 19:58:05 +00:00
|
|
|
Iterator<Map.Entry<K, V>> itr = new EntryIterator();
|
2005-07-16 00:30:23 +00:00
|
|
|
int hashcode = 0;
|
|
|
|
for (int pos = size; pos > 0; pos--)
|
|
|
|
hashcode += itr.next().hashCode();
|
|
|
|
|
|
|
|
return hashcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper method that returns an index in the buckets array for `key'
|
|
|
|
* based on its hashCode().
|
|
|
|
*
|
|
|
|
* @param key the key
|
|
|
|
* @return the bucket number
|
|
|
|
* @throws NullPointerException if key is null
|
|
|
|
*/
|
|
|
|
private int hash(Object key)
|
|
|
|
{
|
|
|
|
// Note: Inline Math.abs here, for less method overhead, and to avoid
|
|
|
|
// a bootstrap dependency, since Math relies on native methods.
|
|
|
|
int hash = key.hashCode() % buckets.length;
|
|
|
|
return hash < 0 ? -hash : hash;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper method for entrySet(), which matches both key and value
|
|
|
|
* simultaneously. Ignores null, as mentioned in entrySet().
|
|
|
|
*
|
|
|
|
* @param o the entry to match
|
|
|
|
* @return the matching entry, if found, or null
|
|
|
|
* @see #entrySet()
|
|
|
|
*/
|
|
|
|
// Package visible, for use in nested classes.
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> getEntry(Object o)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
if (! (o instanceof Map.Entry))
|
|
|
|
return null;
|
2007-01-09 19:58:05 +00:00
|
|
|
K key = ((Map.Entry<K, V>) o).getKey();
|
2005-07-16 00:30:23 +00:00
|
|
|
if (key == null)
|
|
|
|
return null;
|
|
|
|
|
|
|
|
int idx = hash(key);
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = buckets[idx];
|
2005-07-16 00:30:23 +00:00
|
|
|
while (e != null)
|
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
if (e.equals(o))
|
2005-07-16 00:30:23 +00:00
|
|
|
return e;
|
|
|
|
e = e.next;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A simplified, more efficient internal implementation of putAll(). clone()
|
|
|
|
* should not call putAll or put, in order to be compatible with the JDK
|
|
|
|
* implementation with respect to subclasses.
|
|
|
|
*
|
|
|
|
* @param m the map to initialize this from
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
void putAllInternal(Map<? extends K, ? extends V> m)
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com>
* javax/management/NotificationBroadcasterSupport.java
(getNotificationInfo): Add cast.
* native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include
directories.
* native/jni/qt-peer/Makefile.in: Regenerate.
libjava/ChangeLog:
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/natFileWin32.cc (setFilePermissions): New (stub only).
_access: Handle EXEC query, stub only.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Merged from classpath:
* gnu/java/nio/SelectorProviderImpl.java: Whitespace merge.
* java/lang/System.java(inheritedChannel): New.
* java/lang/Character.java: Remove stray`;'.
* java/net/MulticastSocket.java: Merged.
* java/text/DateFormatSymbols.java(getInstance): New, comment updates.
* java/text/Collator.java(getInstance): Merged.
* java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG.
getDisplayName, getDisplayNames: New.
* java/util/logging/Logger.java: Merged.
* Regenerate .class and .h files.
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/File.java: Merge with classpath-0.95, new method
setFilePermissions, new attribute EXEC.
* java/io/natFilePosix.cc (setFilePermissions): New.
_access: Handle EXEC query.
* classpath/lib/java/io/File.class, java/io/File.h: Regenerate.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Imported GNU Classpath 0.95.
* classpath/Makefile.in,
classpath/native/jni/midi-dssi/Makefile.in,
classpath/native/jni/classpath/Makefile.in,
classpath/native/jni/Makefile.in,
classpath/native/jni/gconf-peer/Makefile.in,
classpath/native/jni/java-io/Makefile.in,
classpath/native/jni/native-lib/Makefile.in,
classpath/native/jni/java-util/Makefile.in,
classpath/native/jni/midi-alsa/Makefile.in,
classpath/native/jni/java-lang/Makefile.in,
classpath/native/jni/java-nio/Makefile.in,
classpath/native/jni/java-net/Makefile.in,
classpath/native/jni/xmlj/Makefile.in,
classpath/native/jni/qt-peer/Makefile.in,
classpath/native/jni/gtk-peer/Makefile.in,
classpath/native/Makefile.in, classpath/native/jawt/Makefile.in,
classpath/native/fdlibm/Makefile.in,
classpath/native/plugin/Makefile.in,
classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
classpath/tools/Makefile.in, classpath/doc/Makefile.in,
classpath/doc/api/Makefile.in, classpath/lib/Makefile.in,
classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in,
classpath/external/sax/Makefile.in,
classpath/external/w3c_dom/Makefile.in,
classpath/external/relaxngDatatype/Makefile.in,
classpath/include/Makefile.in,
classpath/examples/Makefile.in: Regenerate.
* classpath/config.guess, classpath/config.sub,
classpath/ltmain.sh : Update.
* classpath/configure, classpath/depcomp, classpath/missing,
classpath/aclocal.m4, classpath/install-sh: Regenerate.
* gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95.
* sources.am: Regenerate.
* Makefile.in: Regenerate.
* Update the .class files and generated CNI header files, add new
.class and generated CNI header files.
* Remove generated files for removed java source files:
classpath/gnu/java/net/BASE64.java,
classpath/gnu/java/security/util/Base64.java,
classpath/gnu/java/awt/peer/gtk/GThreadMutex.java,
classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java,
classpath/gnu/java/awt/font/autofit/Scaler.java,
classpath/gnu/classpath/jdwp/util/Value.java,
classpath/gnu/javax/net/ssl/Base64.java.
* Remove empty directories.
* Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc.
* java/lang/Class.java(setAccessible): Merge from classpath.
* java/util/Locale.java: Remove.
* gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java,
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New.
* gcj/javaprims.h: Update class declarations.
* scripts/classes.pl: Update usage.
* HACKING: Mention to build all peers.
From-SVN: r125302
2007-06-03 23:18:43 +00:00
|
|
|
final Map<K,V> addMap = (Map<K,V>) m;
|
|
|
|
final Iterator<Map.Entry<K,V>> it = addMap.entrySet().iterator();
|
2005-07-16 00:30:23 +00:00
|
|
|
size = 0;
|
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com>
* javax/management/NotificationBroadcasterSupport.java
(getNotificationInfo): Add cast.
* native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include
directories.
* native/jni/qt-peer/Makefile.in: Regenerate.
libjava/ChangeLog:
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/natFileWin32.cc (setFilePermissions): New (stub only).
_access: Handle EXEC query, stub only.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Merged from classpath:
* gnu/java/nio/SelectorProviderImpl.java: Whitespace merge.
* java/lang/System.java(inheritedChannel): New.
* java/lang/Character.java: Remove stray`;'.
* java/net/MulticastSocket.java: Merged.
* java/text/DateFormatSymbols.java(getInstance): New, comment updates.
* java/text/Collator.java(getInstance): Merged.
* java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG.
getDisplayName, getDisplayNames: New.
* java/util/logging/Logger.java: Merged.
* Regenerate .class and .h files.
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/File.java: Merge with classpath-0.95, new method
setFilePermissions, new attribute EXEC.
* java/io/natFilePosix.cc (setFilePermissions): New.
_access: Handle EXEC query.
* classpath/lib/java/io/File.class, java/io/File.h: Regenerate.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Imported GNU Classpath 0.95.
* classpath/Makefile.in,
classpath/native/jni/midi-dssi/Makefile.in,
classpath/native/jni/classpath/Makefile.in,
classpath/native/jni/Makefile.in,
classpath/native/jni/gconf-peer/Makefile.in,
classpath/native/jni/java-io/Makefile.in,
classpath/native/jni/native-lib/Makefile.in,
classpath/native/jni/java-util/Makefile.in,
classpath/native/jni/midi-alsa/Makefile.in,
classpath/native/jni/java-lang/Makefile.in,
classpath/native/jni/java-nio/Makefile.in,
classpath/native/jni/java-net/Makefile.in,
classpath/native/jni/xmlj/Makefile.in,
classpath/native/jni/qt-peer/Makefile.in,
classpath/native/jni/gtk-peer/Makefile.in,
classpath/native/Makefile.in, classpath/native/jawt/Makefile.in,
classpath/native/fdlibm/Makefile.in,
classpath/native/plugin/Makefile.in,
classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
classpath/tools/Makefile.in, classpath/doc/Makefile.in,
classpath/doc/api/Makefile.in, classpath/lib/Makefile.in,
classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in,
classpath/external/sax/Makefile.in,
classpath/external/w3c_dom/Makefile.in,
classpath/external/relaxngDatatype/Makefile.in,
classpath/include/Makefile.in,
classpath/examples/Makefile.in: Regenerate.
* classpath/config.guess, classpath/config.sub,
classpath/ltmain.sh : Update.
* classpath/configure, classpath/depcomp, classpath/missing,
classpath/aclocal.m4, classpath/install-sh: Regenerate.
* gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95.
* sources.am: Regenerate.
* Makefile.in: Regenerate.
* Update the .class files and generated CNI header files, add new
.class and generated CNI header files.
* Remove generated files for removed java source files:
classpath/gnu/java/net/BASE64.java,
classpath/gnu/java/security/util/Base64.java,
classpath/gnu/java/awt/peer/gtk/GThreadMutex.java,
classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java,
classpath/gnu/java/awt/font/autofit/Scaler.java,
classpath/gnu/classpath/jdwp/util/Value.java,
classpath/gnu/javax/net/ssl/Base64.java.
* Remove empty directories.
* Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc.
* java/lang/Class.java(setAccessible): Merge from classpath.
* java/util/Locale.java: Remove.
* gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java,
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New.
* gcj/javaprims.h: Update class declarations.
* scripts/classes.pl: Update usage.
* HACKING: Mention to build all peers.
From-SVN: r125302
2007-06-03 23:18:43 +00:00
|
|
|
while (it.hasNext())
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
libjava/classpath/ChangeLog.gcj:
2007-05-31 Matthias Klose <doko@ubuntu.com>
* javax/management/NotificationBroadcasterSupport.java
(getNotificationInfo): Add cast.
* native/jni/qt-peer/Makefile.am (AM_CXXFLAGS): Add libstdc++ include
directories.
* native/jni/qt-peer/Makefile.in: Regenerate.
libjava/ChangeLog:
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/natFileWin32.cc (setFilePermissions): New (stub only).
_access: Handle EXEC query, stub only.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Merged from classpath:
* gnu/java/nio/SelectorProviderImpl.java: Whitespace merge.
* java/lang/System.java(inheritedChannel): New.
* java/lang/Character.java: Remove stray`;'.
* java/net/MulticastSocket.java: Merged.
* java/text/DateFormatSymbols.java(getInstance): New, comment updates.
* java/text/Collator.java(getInstance): Merged.
* java/util/Calendar.java: New attributes ALL_STYLES, SHORT, LONG.
getDisplayName, getDisplayNames: New.
* java/util/logging/Logger.java: Merged.
* Regenerate .class and .h files.
2007-06-03 Matthias Klose <doko@ubuntu.com>
* java/io/File.java: Merge with classpath-0.95, new method
setFilePermissions, new attribute EXEC.
* java/io/natFilePosix.cc (setFilePermissions): New.
_access: Handle EXEC query.
* classpath/lib/java/io/File.class, java/io/File.h: Regenerate.
2007-06-03 Matthias Klose <doko@ubuntu.com>
Imported GNU Classpath 0.95.
* classpath/Makefile.in,
classpath/native/jni/midi-dssi/Makefile.in,
classpath/native/jni/classpath/Makefile.in,
classpath/native/jni/Makefile.in,
classpath/native/jni/gconf-peer/Makefile.in,
classpath/native/jni/java-io/Makefile.in,
classpath/native/jni/native-lib/Makefile.in,
classpath/native/jni/java-util/Makefile.in,
classpath/native/jni/midi-alsa/Makefile.in,
classpath/native/jni/java-lang/Makefile.in,
classpath/native/jni/java-nio/Makefile.in,
classpath/native/jni/java-net/Makefile.in,
classpath/native/jni/xmlj/Makefile.in,
classpath/native/jni/qt-peer/Makefile.in,
classpath/native/jni/gtk-peer/Makefile.in,
classpath/native/Makefile.in, classpath/native/jawt/Makefile.in,
classpath/native/fdlibm/Makefile.in,
classpath/native/plugin/Makefile.in,
classpath/resource/Makefile.in, classpath/scripts/Makefile.in,
classpath/tools/Makefile.in, classpath/doc/Makefile.in,
classpath/doc/api/Makefile.in, classpath/lib/Makefile.in,
classpath/external/Makefile.in, classpath/external/jsr166/Makefile.in,
classpath/external/sax/Makefile.in,
classpath/external/w3c_dom/Makefile.in,
classpath/external/relaxngDatatype/Makefile.in,
classpath/include/Makefile.in,
classpath/examples/Makefile.in: Regenerate.
* classpath/config.guess, classpath/config.sub,
classpath/ltmain.sh : Update.
* classpath/configure, classpath/depcomp, classpath/missing,
classpath/aclocal.m4, classpath/install-sh: Regenerate.
* gnu/classpath/Configuration.java (CLASSPATH_VERSION): Now 0.95.
* sources.am: Regenerate.
* Makefile.in: Regenerate.
* Update the .class files and generated CNI header files, add new
.class and generated CNI header files.
* Remove generated files for removed java source files:
classpath/gnu/java/net/BASE64.java,
classpath/gnu/java/security/util/Base64.java,
classpath/gnu/java/awt/peer/gtk/GThreadMutex.java,
classpath/gnu/java/awt/peer/gtk/GThreadNativeMethodRunner.java,
classpath/gnu/java/awt/font/autofit/Scaler.java,
classpath/gnu/classpath/jdwp/util/Value.java,
classpath/gnu/javax/net/ssl/Base64.java.
* Remove empty directories.
* Makefile.am(nat_source_files): Add natVMOperatingSystemMXBeanImpl.cc.
* java/lang/Class.java(setAccessible): Merge from classpath.
* java/util/Locale.java: Remove.
* gnu/java/lang/management/VMOperatingSystemMXBeanImpl.java,
gnu/java/lang/management/natVMOperatingSystemMXBeanImpl.cc: New.
* gcj/javaprims.h: Update class declarations.
* scripts/classes.pl: Update usage.
* HACKING: Mention to build all peers.
From-SVN: r125302
2007-06-03 23:18:43 +00:00
|
|
|
final Map.Entry<K,V> e = it.next();
|
2005-07-16 00:30:23 +00:00
|
|
|
size++;
|
2007-01-09 19:58:05 +00:00
|
|
|
K key = e.getKey();
|
2005-07-16 00:30:23 +00:00
|
|
|
int idx = hash(key);
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> he = new HashEntry<K, V>(key, e.getValue());
|
2005-07-16 00:30:23 +00:00
|
|
|
he.next = buckets[idx];
|
|
|
|
buckets[idx] = he;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Increases the size of the Hashtable and rehashes all keys to new array
|
|
|
|
* indices; this is called when the addition of a new value would cause
|
|
|
|
* size() > threshold. Note that the existing Entry objects are reused in
|
|
|
|
* the new hash table.
|
|
|
|
* <p>
|
|
|
|
*
|
|
|
|
* This is not specified, but the new size is twice the current size plus
|
|
|
|
* one; this number is not always prime, unfortunately. This implementation
|
|
|
|
* is not synchronized, as it is only invoked from synchronized methods.
|
|
|
|
*/
|
|
|
|
protected void rehash()
|
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V>[] oldBuckets = buckets;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
int newcapacity = (buckets.length * 2) + 1;
|
|
|
|
threshold = (int) (newcapacity * loadFactor);
|
2007-01-09 19:58:05 +00:00
|
|
|
buckets = (HashEntry<K, V>[]) new HashEntry[newcapacity];
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
for (int i = oldBuckets.length - 1; i >= 0; i--)
|
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = oldBuckets[i];
|
2005-07-16 00:30:23 +00:00
|
|
|
while (e != null)
|
|
|
|
{
|
|
|
|
int idx = hash(e.key);
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> dest = buckets[idx];
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
if (dest != null)
|
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
HashEntry next = dest.next;
|
|
|
|
while (next != null)
|
|
|
|
{
|
|
|
|
dest = next;
|
|
|
|
next = dest.next;
|
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
dest.next = e;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
buckets[idx] = e;
|
|
|
|
}
|
|
|
|
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> next = e.next;
|
2005-07-16 00:30:23 +00:00
|
|
|
e.next = null;
|
|
|
|
e = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Serializes this object to the given stream.
|
|
|
|
*
|
|
|
|
* @param s the stream to write to
|
|
|
|
* @throws IOException if the underlying stream fails
|
|
|
|
* @serialData the <i>capacity</i> (int) that is the length of the
|
|
|
|
* bucket array, the <i>size</i> (int) of the hash map
|
|
|
|
* are emitted first. They are followed by size entries,
|
|
|
|
* each consisting of a key (Object) and a value (Object).
|
|
|
|
*/
|
|
|
|
private synchronized void writeObject(ObjectOutputStream s)
|
|
|
|
throws IOException
|
|
|
|
{
|
|
|
|
// Write the threshold and loadFactor fields.
|
|
|
|
s.defaultWriteObject();
|
|
|
|
|
|
|
|
s.writeInt(buckets.length);
|
|
|
|
s.writeInt(size);
|
|
|
|
// Since we are already synchronized, and entrySet().iterator()
|
|
|
|
// would repeatedly re-lock/release the monitor, we directly use the
|
2006-01-17 18:09:40 +00:00
|
|
|
// unsynchronized EntryIterator instead.
|
2007-01-09 19:58:05 +00:00
|
|
|
Iterator<Map.Entry<K, V>> it = new EntryIterator();
|
2005-07-16 00:30:23 +00:00
|
|
|
while (it.hasNext())
|
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> entry = (HashEntry<K, V>) it.next();
|
2005-07-16 00:30:23 +00:00
|
|
|
s.writeObject(entry.key);
|
|
|
|
s.writeObject(entry.value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Deserializes this object from the given stream.
|
|
|
|
*
|
|
|
|
* @param s the stream to read from
|
|
|
|
* @throws ClassNotFoundException if the underlying stream fails
|
|
|
|
* @throws IOException if the underlying stream fails
|
|
|
|
* @serialData the <i>capacity</i> (int) that is the length of the
|
|
|
|
* bucket array, the <i>size</i> (int) of the hash map
|
|
|
|
* are emitted first. They are followed by size entries,
|
|
|
|
* each consisting of a key (Object) and a value (Object).
|
|
|
|
*/
|
|
|
|
private void readObject(ObjectInputStream s)
|
|
|
|
throws IOException, ClassNotFoundException
|
|
|
|
{
|
|
|
|
// Read the threshold and loadFactor fields.
|
|
|
|
s.defaultReadObject();
|
|
|
|
|
|
|
|
// Read and use capacity.
|
2007-01-09 19:58:05 +00:00
|
|
|
buckets = (HashEntry<K, V>[]) new HashEntry[s.readInt()];
|
2005-07-16 00:30:23 +00:00
|
|
|
int len = s.readInt();
|
|
|
|
|
|
|
|
// Read and use key/value pairs.
|
|
|
|
// TODO: should we be defensive programmers, and check for illegal nulls?
|
|
|
|
while (--len >= 0)
|
2007-01-09 19:58:05 +00:00
|
|
|
put((K) s.readObject(), (V) s.readObject());
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A class which implements the Iterator interface and is used for
|
|
|
|
* iterating over Hashtables.
|
2006-01-17 18:09:40 +00:00
|
|
|
* This implementation iterates entries. Subclasses are used to
|
|
|
|
* iterate key and values. It also allows the removal of elements,
|
|
|
|
* as per the Javasoft spec. Note that it is not synchronized; this
|
|
|
|
* is a performance enhancer since it is never exposed externally
|
|
|
|
* and is only used within synchronized blocks above.
|
2005-07-16 00:30:23 +00:00
|
|
|
*
|
|
|
|
* @author Jon Zeppieri
|
2006-01-17 18:09:40 +00:00
|
|
|
* @author Fridjof Siebert
|
2005-07-16 00:30:23 +00:00
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private class EntryIterator
|
|
|
|
implements Iterator<Entry<K,V>>
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The number of modifications to the backing Hashtable that we know about.
|
|
|
|
*/
|
|
|
|
int knownMod = modCount;
|
|
|
|
/** The number of elements remaining to be returned by next(). */
|
|
|
|
int count = size;
|
|
|
|
/** Current index in the physical hash table. */
|
|
|
|
int idx = buckets.length;
|
|
|
|
/** The last Entry returned by a next() call. */
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> last;
|
2005-07-16 00:30:23 +00:00
|
|
|
/**
|
|
|
|
* The next entry that should be returned by next(). It is set to something
|
|
|
|
* if we're iterating through a bucket that contains multiple linked
|
|
|
|
* entries. It is null if next() needs to find a new bucket.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> next;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
2007-01-09 19:58:05 +00:00
|
|
|
* Construct a new EntryIterator
|
2005-07-16 00:30:23 +00:00
|
|
|
*/
|
2006-01-17 18:09:40 +00:00
|
|
|
EntryIterator()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
|
2005-07-16 00:30:23 +00:00
|
|
|
/**
|
|
|
|
* Returns true if the Iterator has more elements.
|
|
|
|
* @return true if there are more elements
|
|
|
|
*/
|
|
|
|
public boolean hasNext()
|
|
|
|
{
|
|
|
|
return count > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the next element in the Iterator's sequential view.
|
|
|
|
* @return the next element
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
* @throws NoSuchElementException if there is none
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public Map.Entry<K,V> next()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
if (knownMod != modCount)
|
|
|
|
throw new ConcurrentModificationException();
|
|
|
|
if (count == 0)
|
|
|
|
throw new NoSuchElementException();
|
|
|
|
count--;
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = next;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
while (e == null)
|
2006-01-17 18:09:40 +00:00
|
|
|
if (idx <= 0)
|
|
|
|
return null;
|
|
|
|
else
|
|
|
|
e = buckets[--idx];
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
next = e.next;
|
|
|
|
last = e;
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes from the backing Hashtable the last element which was fetched
|
|
|
|
* with the <code>next()</code> method.
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
* @throws IllegalStateException if called when there is no last element
|
|
|
|
*/
|
|
|
|
public void remove()
|
|
|
|
{
|
|
|
|
if (knownMod != modCount)
|
|
|
|
throw new ConcurrentModificationException();
|
|
|
|
if (last == null)
|
|
|
|
throw new IllegalStateException();
|
|
|
|
|
|
|
|
Hashtable.this.remove(last.key);
|
|
|
|
last = null;
|
|
|
|
knownMod++;
|
|
|
|
}
|
2006-01-17 18:09:40 +00:00
|
|
|
} // class EntryIterator
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A class which implements the Iterator interface and is used for
|
2007-01-09 19:58:05 +00:00
|
|
|
* iterating over keys in Hashtables. This class uses an
|
|
|
|
* <code>EntryIterator</code> to obtain the keys of each entry.
|
2006-01-17 18:09:40 +00:00
|
|
|
*
|
|
|
|
* @author Fridtjof Siebert
|
2007-01-09 19:58:05 +00:00
|
|
|
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
|
2006-01-17 18:09:40 +00:00
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private class KeyIterator
|
|
|
|
implements Iterator<K>
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This entry iterator is used for most operations. Only
|
|
|
|
* <code>next()</code> gives a different result, by returning just
|
|
|
|
* the key rather than the whole element.
|
|
|
|
*/
|
2008-06-28 13:29:13 +00:00
|
|
|
private final EntryIterator iterator;
|
2007-01-09 19:58:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new KeyIterator
|
|
|
|
*/
|
|
|
|
KeyIterator()
|
|
|
|
{
|
|
|
|
iterator = new EntryIterator();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the entry iterator has more elements.
|
|
|
|
*
|
|
|
|
* @return true if there are more elements
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
*/
|
|
|
|
public boolean hasNext()
|
|
|
|
{
|
|
|
|
return iterator.hasNext();
|
|
|
|
}
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the next element in the Iterator's sequential view.
|
|
|
|
*
|
|
|
|
* @return the next element
|
|
|
|
*
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
* @throws NoSuchElementException if there is none
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public K next()
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
return ((HashEntry<K,V>) iterator.next()).key;
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2005-07-16 00:30:23 +00:00
|
|
|
|
2007-01-09 19:58:05 +00:00
|
|
|
/**
|
|
|
|
* Removes the last element used by the <code>next()</code> method
|
|
|
|
* using the entry iterator.
|
|
|
|
*
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
* @throws IllegalStateException if called when there is no last element
|
|
|
|
*/
|
|
|
|
public void remove()
|
|
|
|
{
|
|
|
|
iterator.remove();
|
|
|
|
}
|
|
|
|
} // class KeyIterator
|
|
|
|
|
2005-07-16 00:30:23 +00:00
|
|
|
/**
|
2006-01-17 18:09:40 +00:00
|
|
|
* A class which implements the Iterator interface and is used for
|
2007-01-09 19:58:05 +00:00
|
|
|
* iterating over values in Hashtables. This class uses an
|
|
|
|
* <code>EntryIterator</code> to obtain the values of each entry.
|
2006-01-17 18:09:40 +00:00
|
|
|
*
|
|
|
|
* @author Fridtjof Siebert
|
2007-01-09 19:58:05 +00:00
|
|
|
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
|
2006-01-17 18:09:40 +00:00
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private class ValueIterator
|
|
|
|
implements Iterator<V>
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
2007-01-09 19:58:05 +00:00
|
|
|
* This entry iterator is used for most operations. Only
|
|
|
|
* <code>next()</code> gives a different result, by returning just
|
|
|
|
* the value rather than the whole element.
|
|
|
|
*/
|
2008-06-28 13:29:13 +00:00
|
|
|
private final EntryIterator iterator;
|
2007-01-09 19:58:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new KeyIterator
|
|
|
|
*/
|
|
|
|
ValueIterator()
|
|
|
|
{
|
|
|
|
iterator = new EntryIterator();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the entry iterator has more elements.
|
2006-01-17 18:09:40 +00:00
|
|
|
*
|
2007-01-09 19:58:05 +00:00
|
|
|
* @return true if there are more elements
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
*/
|
|
|
|
public boolean hasNext()
|
|
|
|
{
|
|
|
|
return iterator.hasNext();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the value of the next element in the iterator's sequential view.
|
|
|
|
*
|
|
|
|
* @return the next value
|
2006-01-17 18:09:40 +00:00
|
|
|
*
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
* @throws NoSuchElementException if there is none
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public V next()
|
|
|
|
{
|
|
|
|
return ((HashEntry<K,V>) iterator.next()).value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes the last element used by the <code>next()</code> method
|
|
|
|
* using the entry iterator.
|
|
|
|
*
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
* @throws IllegalStateException if called when there is no last element
|
|
|
|
*/
|
|
|
|
public void remove()
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
iterator.remove();
|
2006-01-17 18:09:40 +00:00
|
|
|
}
|
2007-01-09 19:58:05 +00:00
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
} // class ValueIterator
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumeration view of the entries in this Hashtable, providing
|
|
|
|
* sequential access to its elements.
|
2005-07-16 00:30:23 +00:00
|
|
|
*
|
|
|
|
* <b>NOTE</b>: Enumeration is not safe if new elements are put in the table
|
|
|
|
* as this could cause a rehash and we'd completely lose our place. Even
|
|
|
|
* without a rehash, it is undetermined if a new element added would
|
|
|
|
* appear in the enumeration. The spec says nothing about this, but
|
2006-01-17 18:09:40 +00:00
|
|
|
* the "Java Class Libraries" book implies that modifications to the
|
2005-07-16 00:30:23 +00:00
|
|
|
* hashtable during enumeration causes indeterminate results. Don't do it!
|
|
|
|
*
|
|
|
|
* @author Jon Zeppieri
|
2006-01-17 18:09:40 +00:00
|
|
|
* @author Fridjof Siebert
|
2005-07-16 00:30:23 +00:00
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private class EntryEnumerator
|
|
|
|
implements Enumeration<Entry<K,V>>
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
/** The number of elements remaining to be returned by next(). */
|
|
|
|
int count = size;
|
|
|
|
/** Current index in the physical hash table. */
|
|
|
|
int idx = buckets.length;
|
|
|
|
/**
|
|
|
|
* Entry which will be returned by the next nextElement() call. It is
|
|
|
|
* set if we are iterating through a bucket with multiple entries, or null
|
|
|
|
* if we must look in the next bucket.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> next;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct the enumeration.
|
|
|
|
*/
|
2006-01-17 18:09:40 +00:00
|
|
|
EntryEnumerator()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
2006-01-17 18:09:40 +00:00
|
|
|
// Nothing to do here.
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether more elements remain in the enumeration.
|
|
|
|
* @return true if nextElement() will not fail.
|
|
|
|
*/
|
|
|
|
public boolean hasMoreElements()
|
|
|
|
{
|
|
|
|
return count > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the next element.
|
|
|
|
* @return the next element
|
|
|
|
* @throws NoSuchElementException if there is none.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public Map.Entry<K,V> nextElement()
|
2005-07-16 00:30:23 +00:00
|
|
|
{
|
|
|
|
if (count == 0)
|
|
|
|
throw new NoSuchElementException("Hashtable Enumerator");
|
|
|
|
count--;
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K, V> e = next;
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
while (e == null)
|
2006-01-17 18:09:40 +00:00
|
|
|
if (idx <= 0)
|
|
|
|
return null;
|
|
|
|
else
|
|
|
|
e = buckets[--idx];
|
2005-07-16 00:30:23 +00:00
|
|
|
|
|
|
|
next = e.next;
|
2006-01-17 18:09:40 +00:00
|
|
|
return e;
|
|
|
|
}
|
|
|
|
} // class EntryEnumerator
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumeration view of this Hashtable, providing sequential access to its
|
|
|
|
* elements.
|
|
|
|
*
|
|
|
|
* <b>NOTE</b>: Enumeration is not safe if new elements are put in the table
|
|
|
|
* as this could cause a rehash and we'd completely lose our place. Even
|
|
|
|
* without a rehash, it is undetermined if a new element added would
|
|
|
|
* appear in the enumeration. The spec says nothing about this, but
|
|
|
|
* the "Java Class Libraries" book implies that modifications to the
|
|
|
|
* hashtable during enumeration causes indeterminate results. Don't do it!
|
|
|
|
*
|
|
|
|
* @author Jon Zeppieri
|
|
|
|
* @author Fridjof Siebert
|
2007-01-09 19:58:05 +00:00
|
|
|
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
|
2006-01-17 18:09:40 +00:00
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private final class KeyEnumerator
|
|
|
|
implements Enumeration<K>
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
/**
|
|
|
|
* This entry enumerator is used for most operations. Only
|
|
|
|
* <code>nextElement()</code> gives a different result, by returning just
|
|
|
|
* the key rather than the whole element.
|
|
|
|
*/
|
2008-06-28 13:29:13 +00:00
|
|
|
private final EntryEnumerator enumerator;
|
2007-01-09 19:58:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new KeyEnumerator
|
|
|
|
*/
|
|
|
|
KeyEnumerator()
|
|
|
|
{
|
|
|
|
enumerator = new EntryEnumerator();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the entry enumerator has more elements.
|
|
|
|
*
|
|
|
|
* @return true if there are more elements
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
*/
|
|
|
|
public boolean hasMoreElements()
|
|
|
|
{
|
|
|
|
return enumerator.hasMoreElements();
|
|
|
|
}
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the next element.
|
|
|
|
* @return the next element
|
|
|
|
* @throws NoSuchElementException if there is none.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public K nextElement()
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K,V> entry = (HashEntry<K,V>) enumerator.nextElement();
|
|
|
|
K retVal = null;
|
2006-01-17 18:09:40 +00:00
|
|
|
if (entry != null)
|
|
|
|
retVal = entry.key;
|
|
|
|
return retVal;
|
2005-07-16 00:30:23 +00:00
|
|
|
}
|
2006-01-17 18:09:40 +00:00
|
|
|
} // class KeyEnumerator
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Enumeration view of this Hashtable, providing sequential access to its
|
|
|
|
* values.
|
|
|
|
*
|
|
|
|
* <b>NOTE</b>: Enumeration is not safe if new elements are put in the table
|
|
|
|
* as this could cause a rehash and we'd completely lose our place. Even
|
|
|
|
* without a rehash, it is undetermined if a new element added would
|
|
|
|
* appear in the enumeration. The spec says nothing about this, but
|
|
|
|
* the "Java Class Libraries" book implies that modifications to the
|
|
|
|
* hashtable during enumeration causes indeterminate results. Don't do it!
|
|
|
|
*
|
|
|
|
* @author Jon Zeppieri
|
|
|
|
* @author Fridjof Siebert
|
2007-01-09 19:58:05 +00:00
|
|
|
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
|
2006-01-17 18:09:40 +00:00
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
private final class ValueEnumerator
|
|
|
|
implements Enumeration<V>
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
/**
|
|
|
|
* This entry enumerator is used for most operations. Only
|
|
|
|
* <code>nextElement()</code> gives a different result, by returning just
|
|
|
|
* the value rather than the whole element.
|
|
|
|
*/
|
2008-06-28 13:29:13 +00:00
|
|
|
private final EntryEnumerator enumerator;
|
2007-01-09 19:58:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Construct a new ValueEnumerator
|
|
|
|
*/
|
|
|
|
ValueEnumerator()
|
|
|
|
{
|
|
|
|
enumerator = new EntryEnumerator();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the entry enumerator has more elements.
|
|
|
|
*
|
|
|
|
* @return true if there are more elements
|
|
|
|
* @throws ConcurrentModificationException if the hashtable was modified
|
|
|
|
*/
|
|
|
|
public boolean hasMoreElements()
|
|
|
|
{
|
|
|
|
return enumerator.hasMoreElements();
|
|
|
|
}
|
|
|
|
|
2006-01-17 18:09:40 +00:00
|
|
|
/**
|
|
|
|
* Returns the next element.
|
|
|
|
* @return the next element
|
|
|
|
* @throws NoSuchElementException if there is none.
|
|
|
|
*/
|
2007-01-09 19:58:05 +00:00
|
|
|
public V nextElement()
|
2006-01-17 18:09:40 +00:00
|
|
|
{
|
2007-01-09 19:58:05 +00:00
|
|
|
HashEntry<K,V> entry = (HashEntry<K,V>) enumerator.nextElement();
|
|
|
|
V retVal = null;
|
2006-01-17 18:09:40 +00:00
|
|
|
if (entry != null)
|
|
|
|
retVal = entry.value;
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
} // class ValueEnumerator
|
|
|
|
|
2005-07-16 00:30:23 +00:00
|
|
|
} // class Hashtable
|