Package Torello.Java.ReadOnly
Interface ReadOnlyDictionary<K,V>
-
- Type Parameters:
K
- the type of keysV
- the type of mapped values
- All Known Implementing Classes:
ReadOnlyHashtable
,ReadOnlyProperties
public interface ReadOnlyDictionary<K,V>
This interface was originally copied fromGitHub's Open-JDK
Account. Though the original file has been modified, few changes have been applied to the Javadoc Commenting. Due to fact that that is a Javainterface
file, there were few method bodies with Source-Code to begin with - meaning this is largely a copy of Method-Signatures and Java-Doc Comments.
Method and parameter names & types have not been modified whatsoever; but several methods had to be eliminated for not being Read-Only. This Source-File was copied from the original Open JDK-21 file of the same (or, rather, highly similar) Interface-Name. The original file may be viewed on theJDK-21 GitHub
public (and, coincidentally, Read-Only) Source-Release archive for Java Packagejava.util.*
The Original'.java'
Source-File's Header-Copyright Information is included here:File Copyright
. Within that Copyright Notice, it is suggested that a copy of theGNU Public License V2
also be included alongside.Immutable variant of Java Collections Framework abstract classjava.util.Dictionary<K, V>
. This abstract class contains all of the methods that the standard Java abstract class ReadOnlyDictionary contains - except those which would directly or indirectly modify / mutate the internal data-structure.
Hi-Lited Source-Code:- View Here: Torello/Java/ReadOnly/ReadOnlyDictionary.java
- Open New Browser-Tab: Torello/Java/ReadOnly/ReadOnlyDictionary.java
File Size: 3,571 Bytes Line Count: 88 '\n' Characters Found
-
-
Method Summary
Retrieve a Dictionary Value Modifier and Type Method V
get(Object key)
Retrieve an Enumeration of Dictionary Keys Modifier and Type Method Enumeration<K>
keys()
Retrieve an Enumeration of Dictionary Values Modifier and Type Method Enumeration<V>
elements()
Check this Dictionary's Contents Modifier and Type Method boolean
isEmpty()
int
size()
-
-
-
Method Detail
-
size
int size()
Returns the number of entries (distinct keys) in this dictionary.- Returns:
- the number of keys in this dictionary.
-
isEmpty
boolean isEmpty()
Tests if this dictionary maps no keys to value. The general contract for theisEmpty
method is that the result is true if and only if this dictionary contains no entries.- Returns:
true
if this dictionary maps no keys to values;false
otherwise.
-
keys
java.util.Enumeration<K> keys()
Returns an enumeration of the keys in this dictionary. The general contract for the keys method is that anEnumeration
object is returned that will generate all the keys for which this dictionary contains entries.- Returns:
- an enumeration of the keys in this dictionary.
- See Also:
elements()
-
elements
java.util.Enumeration<V> elements()
Returns an enumeration of the values in this dictionary. The general contract for theelements
method is that anEnumeration
is returned that will generate all the elements contained in entries in this dictionary.- Returns:
- an enumeration of the values in this dictionary.
- See Also:
keys()
-
get
V get(java.lang.Object key)
Returns the value to which the key is mapped in this dictionary. The general contract for theisEmpty
method is that if this dictionary contains an entry for the specified key, the associated value is returned; otherwise,null
is returned.- Parameters:
key
- a key in this dictionary.null
if the key is not mapped to any value in this dictionary.- Returns:
- the value to which the key is mapped in this dictionary;
- Throws:
java.lang.NullPointerException
- if thekey
isnull
.
-
-