mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-17 02:10:35 +00:00
Merge
This commit is contained in:
commit
ebed974436
@ -26,23 +26,23 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* This class provides a skeletal implementation of the <tt>Collection</tt>
|
||||
* This class provides a skeletal implementation of the {@code Collection}
|
||||
* interface, to minimize the effort required to implement this interface. <p>
|
||||
*
|
||||
* To implement an unmodifiable collection, the programmer needs only to
|
||||
* extend this class and provide implementations for the <tt>iterator</tt> and
|
||||
* <tt>size</tt> methods. (The iterator returned by the <tt>iterator</tt>
|
||||
* method must implement <tt>hasNext</tt> and <tt>next</tt>.)<p>
|
||||
* extend this class and provide implementations for the {@code iterator} and
|
||||
* {@code size} methods. (The iterator returned by the {@code iterator}
|
||||
* method must implement {@code hasNext} and {@code next}.)<p>
|
||||
*
|
||||
* To implement a modifiable collection, the programmer must additionally
|
||||
* override this class's <tt>add</tt> method (which otherwise throws an
|
||||
* <tt>UnsupportedOperationException</tt>), and the iterator returned by the
|
||||
* <tt>iterator</tt> method must additionally implement its <tt>remove</tt>
|
||||
* override this class's {@code add} method (which otherwise throws an
|
||||
* {@code UnsupportedOperationException}), and the iterator returned by the
|
||||
* {@code iterator} method must additionally implement its {@code remove}
|
||||
* method.<p>
|
||||
*
|
||||
* The programmer should generally provide a void (no argument) and
|
||||
* <tt>Collection</tt> constructor, as per the recommendation in the
|
||||
* <tt>Collection</tt> interface specification.<p>
|
||||
* {@code Collection} constructor, as per the recommendation in the
|
||||
* {@code Collection} interface specification.<p>
|
||||
*
|
||||
* The documentation for each non-abstract method in this class describes its
|
||||
* implementation in detail. Each of these methods may be overridden if
|
||||
@ -81,7 +81,7 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation returns <tt>size() == 0</tt>.
|
||||
* This implementation returns {@code size() == 0}.
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return size() == 0;
|
||||
@ -255,7 +255,7 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation always throws an
|
||||
* <tt>UnsupportedOperationException</tt>.
|
||||
* {@code UnsupportedOperationException}.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
* @throws ClassCastException {@inheritDoc}
|
||||
@ -276,8 +276,8 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
* from the collection using the iterator's remove method.
|
||||
*
|
||||
* <p>Note that this implementation throws an
|
||||
* <tt>UnsupportedOperationException</tt> if the iterator returned by this
|
||||
* collection's iterator method does not implement the <tt>remove</tt>
|
||||
* {@code UnsupportedOperationException} if the iterator returned by this
|
||||
* collection's iterator method does not implement the {@code remove}
|
||||
* method and this collection contains the specified object.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
@ -314,7 +314,7 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
* This implementation iterates over the specified collection,
|
||||
* checking each element returned by the iterator in turn to see
|
||||
* if it's contained in this collection. If all elements are so
|
||||
* contained <tt>true</tt> is returned, otherwise <tt>false</tt>.
|
||||
* contained {@code true} is returned, otherwise {@code false}.
|
||||
*
|
||||
* @throws ClassCastException {@inheritDoc}
|
||||
* @throws NullPointerException {@inheritDoc}
|
||||
@ -335,7 +335,7 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
* each object returned by the iterator to this collection, in turn.
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> unless <tt>add</tt> is
|
||||
* {@code UnsupportedOperationException} unless {@code add} is
|
||||
* overridden (assuming the specified collection is non-empty).
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
@ -361,11 +361,11 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
* This implementation iterates over this collection, checking each
|
||||
* element returned by the iterator in turn to see if it's contained
|
||||
* in the specified collection. If it's so contained, it's removed from
|
||||
* this collection with the iterator's <tt>remove</tt> method.
|
||||
* this collection with the iterator's {@code remove} method.
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> if the iterator returned by the
|
||||
* <tt>iterator</tt> method does not implement the <tt>remove</tt> method
|
||||
* {@code UnsupportedOperationException} if the iterator returned by the
|
||||
* {@code iterator} method does not implement the {@code remove} method
|
||||
* and this collection contains one or more elements in common with the
|
||||
* specified collection.
|
||||
*
|
||||
@ -396,11 +396,11 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
* This implementation iterates over this collection, checking each
|
||||
* element returned by the iterator in turn to see if it's contained
|
||||
* in the specified collection. If it's not so contained, it's removed
|
||||
* from this collection with the iterator's <tt>remove</tt> method.
|
||||
* from this collection with the iterator's {@code remove} method.
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> if the iterator returned by the
|
||||
* <tt>iterator</tt> method does not implement the <tt>remove</tt> method
|
||||
* {@code UnsupportedOperationException} if the iterator returned by the
|
||||
* {@code iterator} method does not implement the {@code remove} method
|
||||
* and this collection contains one or more elements not present in the
|
||||
* specified collection.
|
||||
*
|
||||
@ -429,14 +429,14 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation iterates over this collection, removing each
|
||||
* element using the <tt>Iterator.remove</tt> operation. Most
|
||||
* element using the {@code Iterator.remove} operation. Most
|
||||
* implementations will probably choose to override this method for
|
||||
* efficiency.
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> if the iterator returned by this
|
||||
* collection's <tt>iterator</tt> method does not implement the
|
||||
* <tt>remove</tt> method and this collection is non-empty.
|
||||
* {@code UnsupportedOperationException} if the iterator returned by this
|
||||
* collection's {@code iterator} method does not implement the
|
||||
* {@code remove} method and this collection is non-empty.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
*/
|
||||
@ -455,8 +455,8 @@ public abstract class AbstractCollection<E> implements Collection<E> {
|
||||
* Returns a string representation of this collection. The string
|
||||
* representation consists of a list of the collection's elements in the
|
||||
* order they are returned by its iterator, enclosed in square brackets
|
||||
* (<tt>"[]"</tt>). Adjacent elements are separated by the characters
|
||||
* <tt>", "</tt> (comma and space). Elements are converted to strings as
|
||||
* ({@code "[]"}). Adjacent elements are separated by the characters
|
||||
* {@code ", "} (comma and space). Elements are converted to strings as
|
||||
* by {@link String#valueOf(Object)}.
|
||||
*
|
||||
* @return a string representation of this collection
|
||||
|
||||
@ -27,24 +27,24 @@ package java.util;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* This class provides a skeletal implementation of the <tt>Map</tt>
|
||||
* This class provides a skeletal implementation of the {@code Map}
|
||||
* interface, to minimize the effort required to implement this interface.
|
||||
*
|
||||
* <p>To implement an unmodifiable map, the programmer needs only to extend this
|
||||
* class and provide an implementation for the <tt>entrySet</tt> method, which
|
||||
* class and provide an implementation for the {@code entrySet} method, which
|
||||
* returns a set-view of the map's mappings. Typically, the returned set
|
||||
* will, in turn, be implemented atop <tt>AbstractSet</tt>. This set should
|
||||
* not support the <tt>add</tt> or <tt>remove</tt> methods, and its iterator
|
||||
* should not support the <tt>remove</tt> method.
|
||||
* will, in turn, be implemented atop {@code AbstractSet}. This set should
|
||||
* not support the {@code add} or {@code remove} methods, and its iterator
|
||||
* should not support the {@code remove} method.
|
||||
*
|
||||
* <p>To implement a modifiable map, the programmer must additionally override
|
||||
* this class's <tt>put</tt> method (which otherwise throws an
|
||||
* <tt>UnsupportedOperationException</tt>), and the iterator returned by
|
||||
* <tt>entrySet().iterator()</tt> must additionally implement its
|
||||
* <tt>remove</tt> method.
|
||||
* this class's {@code put} method (which otherwise throws an
|
||||
* {@code UnsupportedOperationException}), and the iterator returned by
|
||||
* {@code entrySet().iterator()} must additionally implement its
|
||||
* {@code remove} method.
|
||||
*
|
||||
* <p>The programmer should generally provide a void (no argument) and map
|
||||
* constructor, as per the recommendation in the <tt>Map</tt> interface
|
||||
* constructor, as per the recommendation in the {@code Map} interface
|
||||
* specification.
|
||||
*
|
||||
* <p>The documentation for each non-abstract method in this class describes its
|
||||
@ -79,7 +79,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation returns <tt>entrySet().size()</tt>.
|
||||
* This implementation returns {@code entrySet().size()}.
|
||||
*/
|
||||
public int size() {
|
||||
return entrySet().size();
|
||||
@ -89,7 +89,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation returns <tt>size() == 0</tt>.
|
||||
* This implementation returns {@code size() == 0}.
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return size() == 0;
|
||||
@ -99,10 +99,10 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation iterates over <tt>entrySet()</tt> searching
|
||||
* This implementation iterates over {@code entrySet()} searching
|
||||
* for an entry with the specified value. If such an entry is found,
|
||||
* <tt>true</tt> is returned. If the iteration terminates without
|
||||
* finding such an entry, <tt>false</tt> is returned. Note that this
|
||||
* {@code true} is returned. If the iteration terminates without
|
||||
* finding such an entry, {@code false} is returned. Note that this
|
||||
* implementation requires linear time in the size of the map.
|
||||
*
|
||||
* @throws ClassCastException {@inheritDoc}
|
||||
@ -130,10 +130,10 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation iterates over <tt>entrySet()</tt> searching
|
||||
* This implementation iterates over {@code entrySet()} searching
|
||||
* for an entry with the specified key. If such an entry is found,
|
||||
* <tt>true</tt> is returned. If the iteration terminates without
|
||||
* finding such an entry, <tt>false</tt> is returned. Note that this
|
||||
* {@code true} is returned. If the iteration terminates without
|
||||
* finding such an entry, {@code false} is returned. Note that this
|
||||
* implementation requires linear time in the size of the map; many
|
||||
* implementations will override this method.
|
||||
*
|
||||
@ -162,10 +162,10 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation iterates over <tt>entrySet()</tt> searching
|
||||
* This implementation iterates over {@code entrySet()} searching
|
||||
* for an entry with the specified key. If such an entry is found,
|
||||
* the entry's value is returned. If the iteration terminates without
|
||||
* finding such an entry, <tt>null</tt> is returned. Note that this
|
||||
* finding such an entry, {@code null} is returned. Note that this
|
||||
* implementation requires linear time in the size of the map; many
|
||||
* implementations will override this method.
|
||||
*
|
||||
@ -198,7 +198,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation always throws an
|
||||
* <tt>UnsupportedOperationException</tt>.
|
||||
* {@code UnsupportedOperationException}.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
* @throws ClassCastException {@inheritDoc}
|
||||
@ -213,18 +213,18 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation iterates over <tt>entrySet()</tt> searching for an
|
||||
* This implementation iterates over {@code entrySet()} searching for an
|
||||
* entry with the specified key. If such an entry is found, its value is
|
||||
* obtained with its <tt>getValue</tt> operation, the entry is removed
|
||||
* obtained with its {@code getValue} operation, the entry is removed
|
||||
* from the collection (and the backing map) with the iterator's
|
||||
* <tt>remove</tt> operation, and the saved value is returned. If the
|
||||
* iteration terminates without finding such an entry, <tt>null</tt> is
|
||||
* {@code remove} operation, and the saved value is returned. If the
|
||||
* iteration terminates without finding such an entry, {@code null} is
|
||||
* returned. Note that this implementation requires linear time in the
|
||||
* size of the map; many implementations will override this method.
|
||||
*
|
||||
* <p>Note that this implementation throws an
|
||||
* <tt>UnsupportedOperationException</tt> if the <tt>entrySet</tt>
|
||||
* iterator does not support the <tt>remove</tt> method and this map
|
||||
* {@code UnsupportedOperationException} if the {@code entrySet}
|
||||
* iterator does not support the {@code remove} method and this map
|
||||
* contains a mapping for the specified key.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
@ -264,12 +264,12 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation iterates over the specified map's
|
||||
* <tt>entrySet()</tt> collection, and calls this map's <tt>put</tt>
|
||||
* {@code entrySet()} collection, and calls this map's {@code put}
|
||||
* operation once for each entry returned by the iteration.
|
||||
*
|
||||
* <p>Note that this implementation throws an
|
||||
* <tt>UnsupportedOperationException</tt> if this map does not support
|
||||
* the <tt>put</tt> operation and the specified map is nonempty.
|
||||
* {@code UnsupportedOperationException} if this map does not support
|
||||
* the {@code put} operation and the specified map is nonempty.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
* @throws ClassCastException {@inheritDoc}
|
||||
@ -285,11 +285,11 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation calls <tt>entrySet().clear()</tt>.
|
||||
* This implementation calls {@code entrySet().clear()}.
|
||||
*
|
||||
* <p>Note that this implementation throws an
|
||||
* <tt>UnsupportedOperationException</tt> if the <tt>entrySet</tt>
|
||||
* does not support the <tt>clear</tt> operation.
|
||||
* {@code UnsupportedOperationException} if the {@code entrySet}
|
||||
* does not support the {@code clear} operation.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
*/
|
||||
@ -314,10 +314,10 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* @implSpec
|
||||
* This implementation returns a set that subclasses {@link AbstractSet}.
|
||||
* The subclass's iterator method returns a "wrapper object" over this
|
||||
* map's <tt>entrySet()</tt> iterator. The <tt>size</tt> method
|
||||
* delegates to this map's <tt>size</tt> method and the
|
||||
* <tt>contains</tt> method delegates to this map's
|
||||
* <tt>containsKey</tt> method.
|
||||
* map's {@code entrySet()} iterator. The {@code size} method
|
||||
* delegates to this map's {@code size} method and the
|
||||
* {@code contains} method delegates to this map's
|
||||
* {@code containsKey} method.
|
||||
*
|
||||
* <p>The set is created the first time this method is called,
|
||||
* and returned in response to all subsequent calls. No synchronization
|
||||
@ -371,10 +371,10 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
* @implSpec
|
||||
* This implementation returns a collection that subclasses {@link
|
||||
* AbstractCollection}. The subclass's iterator method returns a
|
||||
* "wrapper object" over this map's <tt>entrySet()</tt> iterator.
|
||||
* The <tt>size</tt> method delegates to this map's <tt>size</tt>
|
||||
* method and the <tt>contains</tt> method delegates to this map's
|
||||
* <tt>containsValue</tt> method.
|
||||
* "wrapper object" over this map's {@code entrySet()} iterator.
|
||||
* The {@code size} method delegates to this map's {@code size}
|
||||
* method and the {@code contains} method delegates to this map's
|
||||
* {@code containsValue} method.
|
||||
*
|
||||
* <p>The collection is created the first time this method is called, and
|
||||
* returned in response to all subsequent calls. No synchronization is
|
||||
@ -429,25 +429,25 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
|
||||
/**
|
||||
* Compares the specified object with this map for equality. Returns
|
||||
* <tt>true</tt> if the given object is also a map and the two maps
|
||||
* represent the same mappings. More formally, two maps <tt>m1</tt> and
|
||||
* <tt>m2</tt> represent the same mappings if
|
||||
* <tt>m1.entrySet().equals(m2.entrySet())</tt>. This ensures that the
|
||||
* <tt>equals</tt> method works properly across different implementations
|
||||
* of the <tt>Map</tt> interface.
|
||||
* {@code true} if the given object is also a map and the two maps
|
||||
* represent the same mappings. More formally, two maps {@code m1} and
|
||||
* {@code m2} represent the same mappings if
|
||||
* {@code m1.entrySet().equals(m2.entrySet())}. This ensures that the
|
||||
* {@code equals} method works properly across different implementations
|
||||
* of the {@code Map} interface.
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation first checks if the specified object is this map;
|
||||
* if so it returns <tt>true</tt>. Then, it checks if the specified
|
||||
* if so it returns {@code true}. Then, it checks if the specified
|
||||
* object is a map whose size is identical to the size of this map; if
|
||||
* not, it returns <tt>false</tt>. If so, it iterates over this map's
|
||||
* <tt>entrySet</tt> collection, and checks that the specified map
|
||||
* not, it returns {@code false}. If so, it iterates over this map's
|
||||
* {@code entrySet} collection, and checks that the specified map
|
||||
* contains each mapping that this map contains. If the specified map
|
||||
* fails to contain such a mapping, <tt>false</tt> is returned. If the
|
||||
* iteration completes, <tt>true</tt> is returned.
|
||||
* fails to contain such a mapping, {@code false} is returned. If the
|
||||
* iteration completes, {@code true} is returned.
|
||||
*
|
||||
* @param o object to be compared for equality with this map
|
||||
* @return <tt>true</tt> if the specified object is equal to this map
|
||||
* @return {@code true} if the specified object is equal to this map
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (o == this)
|
||||
@ -483,13 +483,13 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
/**
|
||||
* Returns the hash code value for this map. The hash code of a map is
|
||||
* defined to be the sum of the hash codes of each entry in the map's
|
||||
* <tt>entrySet()</tt> view. This ensures that <tt>m1.equals(m2)</tt>
|
||||
* implies that <tt>m1.hashCode()==m2.hashCode()</tt> for any two maps
|
||||
* <tt>m1</tt> and <tt>m2</tt>, as required by the general contract of
|
||||
* {@code entrySet()} view. This ensures that {@code m1.equals(m2)}
|
||||
* implies that {@code m1.hashCode()==m2.hashCode()} for any two maps
|
||||
* {@code m1} and {@code m2}, as required by the general contract of
|
||||
* {@link Object#hashCode}.
|
||||
*
|
||||
* @implSpec
|
||||
* This implementation iterates over <tt>entrySet()</tt>, calling
|
||||
* This implementation iterates over {@code entrySet()}, calling
|
||||
* {@link Map.Entry#hashCode hashCode()} on each element (entry) in the
|
||||
* set, and adding up the results.
|
||||
*
|
||||
@ -508,10 +508,10 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
/**
|
||||
* Returns a string representation of this map. The string representation
|
||||
* consists of a list of key-value mappings in the order returned by the
|
||||
* map's <tt>entrySet</tt> view's iterator, enclosed in braces
|
||||
* (<tt>"{}"</tt>). Adjacent mappings are separated by the characters
|
||||
* <tt>", "</tt> (comma and space). Each key-value mapping is rendered as
|
||||
* the key followed by an equals sign (<tt>"="</tt>) followed by the
|
||||
* map's {@code entrySet} view's iterator, enclosed in braces
|
||||
* ({@code "{}"}). Adjacent mappings are separated by the characters
|
||||
* {@code ", "} (comma and space). Each key-value mapping is rendered as
|
||||
* the key followed by an equals sign ({@code "="}) followed by the
|
||||
* associated value. Keys and values are converted to strings as by
|
||||
* {@link String#valueOf(Object)}.
|
||||
*
|
||||
@ -538,7 +538,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a shallow copy of this <tt>AbstractMap</tt> instance: the keys
|
||||
* Returns a shallow copy of this {@code AbstractMap} instance: the keys
|
||||
* and values themselves are not cloned.
|
||||
*
|
||||
* @return a shallow copy of this map
|
||||
@ -570,11 +570,11 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
|
||||
/**
|
||||
* An Entry maintaining a key and a value. The value may be
|
||||
* changed using the <tt>setValue</tt> method. This class
|
||||
* changed using the {@code setValue} method. This class
|
||||
* facilitates the process of building custom map
|
||||
* implementations. For example, it may be convenient to return
|
||||
* arrays of <tt>SimpleEntry</tt> instances in method
|
||||
* <tt>Map.entrySet().toArray</tt>.
|
||||
* arrays of {@code SimpleEntry} instances in method
|
||||
* {@code Map.entrySet().toArray}.
|
||||
*
|
||||
* @since 1.6
|
||||
*/
|
||||
@ -689,7 +689,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
/**
|
||||
* Returns a String representation of this map entry. This
|
||||
* implementation returns the string representation of this
|
||||
* entry's key followed by the equals character ("<tt>=</tt>")
|
||||
* entry's key followed by the equals character ("{@code =}")
|
||||
* followed by the string representation of this entry's value.
|
||||
*
|
||||
* @return a String representation of this map entry
|
||||
@ -702,7 +702,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
|
||||
/**
|
||||
* An Entry maintaining an immutable key and value. This class
|
||||
* does not support method <tt>setValue</tt>. This class may be
|
||||
* does not support method {@code setValue}. This class may be
|
||||
* convenient in methods that return thread-safe snapshots of
|
||||
* key-value mappings.
|
||||
*
|
||||
@ -760,7 +760,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
/**
|
||||
* Replaces the value corresponding to this entry with the specified
|
||||
* value (optional operation). This implementation simply throws
|
||||
* <tt>UnsupportedOperationException</tt>, as this class implements
|
||||
* {@code UnsupportedOperationException}, as this class implements
|
||||
* an <i>immutable</i> map entry.
|
||||
*
|
||||
* @param value new value to be stored in this entry
|
||||
@ -820,7 +820,7 @@ public abstract class AbstractMap<K,V> implements Map<K,V> {
|
||||
/**
|
||||
* Returns a String representation of this map entry. This
|
||||
* implementation returns the string representation of this
|
||||
* entry's key followed by the equals character ("<tt>=</tt>")
|
||||
* entry's key followed by the equals character ("{@code =}")
|
||||
* followed by the string representation of this entry's value.
|
||||
*
|
||||
* @return a String representation of this map entry
|
||||
|
||||
@ -26,31 +26,31 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* This class provides a skeletal implementation of the <tt>List</tt>
|
||||
* This class provides a skeletal implementation of the {@code List}
|
||||
* interface to minimize the effort required to implement this interface
|
||||
* backed by a "sequential access" data store (such as a linked list). For
|
||||
* random access data (such as an array), <tt>AbstractList</tt> should be used
|
||||
* random access data (such as an array), {@code AbstractList} should be used
|
||||
* in preference to this class.<p>
|
||||
*
|
||||
* This class is the opposite of the <tt>AbstractList</tt> class in the sense
|
||||
* that it implements the "random access" methods (<tt>get(int index)</tt>,
|
||||
* <tt>set(int index, E element)</tt>, <tt>add(int index, E element)</tt> and
|
||||
* <tt>remove(int index)</tt>) on top of the list's list iterator, instead of
|
||||
* This class is the opposite of the {@code AbstractList} class in the sense
|
||||
* that it implements the "random access" methods ({@code get(int index)},
|
||||
* {@code set(int index, E element)}, {@code add(int index, E element)} and
|
||||
* {@code remove(int index)}) on top of the list's list iterator, instead of
|
||||
* the other way around.<p>
|
||||
*
|
||||
* To implement a list the programmer needs only to extend this class and
|
||||
* provide implementations for the <tt>listIterator</tt> and <tt>size</tt>
|
||||
* provide implementations for the {@code listIterator} and {@code size}
|
||||
* methods. For an unmodifiable list, the programmer need only implement the
|
||||
* list iterator's <tt>hasNext</tt>, <tt>next</tt>, <tt>hasPrevious</tt>,
|
||||
* <tt>previous</tt> and <tt>index</tt> methods.<p>
|
||||
* list iterator's {@code hasNext}, {@code next}, {@code hasPrevious},
|
||||
* {@code previous} and {@code index} methods.<p>
|
||||
*
|
||||
* For a modifiable list the programmer should additionally implement the list
|
||||
* iterator's <tt>set</tt> method. For a variable-size list the programmer
|
||||
* should additionally implement the list iterator's <tt>remove</tt> and
|
||||
* <tt>add</tt> methods.<p>
|
||||
* iterator's {@code set} method. For a variable-size list the programmer
|
||||
* should additionally implement the list iterator's {@code remove} and
|
||||
* {@code add} methods.<p>
|
||||
*
|
||||
* The programmer should generally provide a void (no argument) and collection
|
||||
* constructor, as per the recommendation in the <tt>Collection</tt> interface
|
||||
* constructor, as per the recommendation in the {@code Collection} interface
|
||||
* specification.<p>
|
||||
*
|
||||
* This class is a member of the
|
||||
@ -78,8 +78,8 @@ public abstract class AbstractSequentialList<E> extends AbstractList<E> {
|
||||
* Returns the element at the specified position in this list.
|
||||
*
|
||||
* <p>This implementation first gets a list iterator pointing to the
|
||||
* indexed element (with <tt>listIterator(index)</tt>). Then, it gets
|
||||
* the element using <tt>ListIterator.next</tt> and returns it.
|
||||
* indexed element (with {@code listIterator(index)}). Then, it gets
|
||||
* the element using {@code ListIterator.next} and returns it.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException {@inheritDoc}
|
||||
*/
|
||||
@ -96,13 +96,13 @@ public abstract class AbstractSequentialList<E> extends AbstractList<E> {
|
||||
* specified element (optional operation).
|
||||
*
|
||||
* <p>This implementation first gets a list iterator pointing to the
|
||||
* indexed element (with <tt>listIterator(index)</tt>). Then, it gets
|
||||
* the current element using <tt>ListIterator.next</tt> and replaces it
|
||||
* with <tt>ListIterator.set</tt>.
|
||||
* indexed element (with {@code listIterator(index)}). Then, it gets
|
||||
* the current element using {@code ListIterator.next} and replaces it
|
||||
* with {@code ListIterator.set}.
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> if the list iterator does not
|
||||
* implement the <tt>set</tt> operation.
|
||||
* {@code UnsupportedOperationException} if the list iterator does not
|
||||
* implement the {@code set} operation.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
* @throws ClassCastException {@inheritDoc}
|
||||
@ -128,12 +128,12 @@ public abstract class AbstractSequentialList<E> extends AbstractList<E> {
|
||||
* indices).
|
||||
*
|
||||
* <p>This implementation first gets a list iterator pointing to the
|
||||
* indexed element (with <tt>listIterator(index)</tt>). Then, it
|
||||
* inserts the specified element with <tt>ListIterator.add</tt>.
|
||||
* indexed element (with {@code listIterator(index)}). Then, it
|
||||
* inserts the specified element with {@code ListIterator.add}.
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> if the list iterator does not
|
||||
* implement the <tt>add</tt> operation.
|
||||
* {@code UnsupportedOperationException} if the list iterator does not
|
||||
* implement the {@code add} operation.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
* @throws ClassCastException {@inheritDoc}
|
||||
@ -156,12 +156,12 @@ public abstract class AbstractSequentialList<E> extends AbstractList<E> {
|
||||
* list.
|
||||
*
|
||||
* <p>This implementation first gets a list iterator pointing to the
|
||||
* indexed element (with <tt>listIterator(index)</tt>). Then, it removes
|
||||
* the element with <tt>ListIterator.remove</tt>.
|
||||
* indexed element (with {@code listIterator(index)}). Then, it removes
|
||||
* the element with {@code ListIterator.remove}.
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> if the list iterator does not
|
||||
* implement the <tt>remove</tt> operation.
|
||||
* {@code UnsupportedOperationException} if the list iterator does not
|
||||
* implement the {@code remove} operation.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
* @throws IndexOutOfBoundsException {@inheritDoc}
|
||||
@ -193,14 +193,14 @@ public abstract class AbstractSequentialList<E> extends AbstractList<E> {
|
||||
*
|
||||
* <p>This implementation gets an iterator over the specified collection and
|
||||
* a list iterator over this list pointing to the indexed element (with
|
||||
* <tt>listIterator(index)</tt>). Then, it iterates over the specified
|
||||
* {@code listIterator(index)}). Then, it iterates over the specified
|
||||
* collection, inserting the elements obtained from the iterator into this
|
||||
* list, one at a time, using <tt>ListIterator.add</tt> followed by
|
||||
* <tt>ListIterator.next</tt> (to skip over the added element).
|
||||
* list, one at a time, using {@code ListIterator.add} followed by
|
||||
* {@code ListIterator.next} (to skip over the added element).
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> if the list iterator returned by
|
||||
* the <tt>listIterator</tt> method does not implement the <tt>add</tt>
|
||||
* {@code UnsupportedOperationException} if the list iterator returned by
|
||||
* the {@code listIterator} method does not implement the {@code add}
|
||||
* operation.
|
||||
*
|
||||
* @throws UnsupportedOperationException {@inheritDoc}
|
||||
@ -243,7 +243,7 @@ public abstract class AbstractSequentialList<E> extends AbstractList<E> {
|
||||
* sequence).
|
||||
*
|
||||
* @param index index of first element to be returned from the list
|
||||
* iterator (by a call to the <code>next</code> method)
|
||||
* iterator (by a call to the {@code next} method)
|
||||
* @return a list iterator over the elements in this list (in proper
|
||||
* sequence)
|
||||
* @throws IndexOutOfBoundsException {@inheritDoc}
|
||||
|
||||
@ -26,20 +26,20 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* This class provides a skeletal implementation of the <tt>Set</tt>
|
||||
* This class provides a skeletal implementation of the {@code Set}
|
||||
* interface to minimize the effort required to implement this
|
||||
* interface. <p>
|
||||
*
|
||||
* The process of implementing a set by extending this class is identical
|
||||
* to that of implementing a Collection by extending AbstractCollection,
|
||||
* except that all of the methods and constructors in subclasses of this
|
||||
* class must obey the additional constraints imposed by the <tt>Set</tt>
|
||||
* class must obey the additional constraints imposed by the {@code Set}
|
||||
* interface (for instance, the add method must not permit addition of
|
||||
* multiple instances of an object to a set).<p>
|
||||
*
|
||||
* Note that this class does not override any of the implementations from
|
||||
* the <tt>AbstractCollection</tt> class. It merely adds implementations
|
||||
* for <tt>equals</tt> and <tt>hashCode</tt>.<p>
|
||||
* the {@code AbstractCollection} class. It merely adds implementations
|
||||
* for {@code equals} and {@code hashCode}.<p>
|
||||
*
|
||||
* This class is a member of the
|
||||
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
|
||||
@ -67,20 +67,20 @@ public abstract class AbstractSet<E> extends AbstractCollection<E> implements Se
|
||||
|
||||
/**
|
||||
* Compares the specified object with this set for equality. Returns
|
||||
* <tt>true</tt> if the given object is also a set, the two sets have
|
||||
* {@code true} if the given object is also a set, the two sets have
|
||||
* the same size, and every member of the given set is contained in
|
||||
* this set. This ensures that the <tt>equals</tt> method works
|
||||
* properly across different implementations of the <tt>Set</tt>
|
||||
* this set. This ensures that the {@code equals} method works
|
||||
* properly across different implementations of the {@code Set}
|
||||
* interface.<p>
|
||||
*
|
||||
* This implementation first checks if the specified object is this
|
||||
* set; if so it returns <tt>true</tt>. Then, it checks if the
|
||||
* set; if so it returns {@code true}. Then, it checks if the
|
||||
* specified object is a set whose size is identical to the size of
|
||||
* this set; if not, it returns false. If so, it returns
|
||||
* <tt>containsAll((Collection) o)</tt>.
|
||||
* {@code containsAll((Collection) o)}.
|
||||
*
|
||||
* @param o object to be compared for equality with this set
|
||||
* @return <tt>true</tt> if the specified object is equal to this set
|
||||
* @return {@code true} if the specified object is equal to this set
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (o == this)
|
||||
@ -103,14 +103,14 @@ public abstract class AbstractSet<E> extends AbstractCollection<E> implements Se
|
||||
/**
|
||||
* Returns the hash code value for this set. The hash code of a set is
|
||||
* defined to be the sum of the hash codes of the elements in the set,
|
||||
* where the hash code of a <tt>null</tt> element is defined to be zero.
|
||||
* This ensures that <tt>s1.equals(s2)</tt> implies that
|
||||
* <tt>s1.hashCode()==s2.hashCode()</tt> for any two sets <tt>s1</tt>
|
||||
* and <tt>s2</tt>, as required by the general contract of
|
||||
* where the hash code of a {@code null} element is defined to be zero.
|
||||
* This ensures that {@code s1.equals(s2)} implies that
|
||||
* {@code s1.hashCode()==s2.hashCode()} for any two sets {@code s1}
|
||||
* and {@code s2}, as required by the general contract of
|
||||
* {@link Object#hashCode}.
|
||||
*
|
||||
* <p>This implementation iterates over the set, calling the
|
||||
* <tt>hashCode</tt> method on each element in the set, and adding up
|
||||
* {@code hashCode} method on each element in the set, and adding up
|
||||
* the results.
|
||||
*
|
||||
* @return the hash code value for this set
|
||||
@ -136,24 +136,24 @@ public abstract class AbstractSet<E> extends AbstractCollection<E> implements Se
|
||||
* the two sets.
|
||||
*
|
||||
* <p>This implementation determines which is the smaller of this set
|
||||
* and the specified collection, by invoking the <tt>size</tt>
|
||||
* and the specified collection, by invoking the {@code size}
|
||||
* method on each. If this set has fewer elements, then the
|
||||
* implementation iterates over this set, checking each element
|
||||
* returned by the iterator in turn to see if it is contained in
|
||||
* the specified collection. If it is so contained, it is removed
|
||||
* from this set with the iterator's <tt>remove</tt> method. If
|
||||
* from this set with the iterator's {@code remove} method. If
|
||||
* the specified collection has fewer elements, then the
|
||||
* implementation iterates over the specified collection, removing
|
||||
* from this set each element returned by the iterator, using this
|
||||
* set's <tt>remove</tt> method.
|
||||
* set's {@code remove} method.
|
||||
*
|
||||
* <p>Note that this implementation will throw an
|
||||
* <tt>UnsupportedOperationException</tt> if the iterator returned by the
|
||||
* <tt>iterator</tt> method does not implement the <tt>remove</tt> method.
|
||||
* {@code UnsupportedOperationException} if the iterator returned by the
|
||||
* {@code iterator} method does not implement the {@code remove} method.
|
||||
*
|
||||
* @param c collection containing elements to be removed from this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>removeAll</tt> operation
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code removeAll} operation
|
||||
* is not supported by this set
|
||||
* @throws ClassCastException if the class of an element of this set
|
||||
* is incompatible with the specified collection
|
||||
|
||||
@ -294,7 +294,7 @@ public class ArrayList<E> extends AbstractList<E>
|
||||
* Returns {@code true} if this list contains the specified element.
|
||||
* More formally, returns {@code true} if and only if this list contains
|
||||
* at least one element {@code e} such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>.
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param o element whose presence in this list is to be tested
|
||||
* @return {@code true} if this list contains the specified element
|
||||
@ -307,7 +307,7 @@ public class ArrayList<E> extends AbstractList<E>
|
||||
* Returns the index of the first occurrence of the specified element
|
||||
* in this list, or -1 if this list does not contain the element.
|
||||
* More formally, returns the lowest index {@code i} such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
|
||||
* {@code Objects.equals(o, get(i))},
|
||||
* or -1 if there is no such index.
|
||||
*/
|
||||
public int indexOf(Object o) {
|
||||
@ -327,7 +327,7 @@ public class ArrayList<E> extends AbstractList<E>
|
||||
* Returns the index of the last occurrence of the specified element
|
||||
* in this list, or -1 if this list does not contain the element.
|
||||
* More formally, returns the highest index {@code i} such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
|
||||
* {@code Objects.equals(o, get(i))},
|
||||
* or -1 if there is no such index.
|
||||
*/
|
||||
public int lastIndexOf(Object o) {
|
||||
@ -511,7 +511,7 @@ public class ArrayList<E> extends AbstractList<E>
|
||||
* if it is present. If the list does not contain the element, it is
|
||||
* unchanged. More formally, removes the element with the lowest index
|
||||
* {@code i} such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>
|
||||
* {@code Objects.equals(o, get(i))}
|
||||
* (if such an element exists). Returns {@code true} if this list
|
||||
* contained the specified element (or equivalently, if this list
|
||||
* changed as a result of the call).
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -35,30 +35,30 @@ import java.util.stream.StreamSupport;
|
||||
* collections allow duplicate elements and others do not. Some are ordered
|
||||
* and others unordered. The JDK does not provide any <i>direct</i>
|
||||
* implementations of this interface: it provides implementations of more
|
||||
* specific subinterfaces like <tt>Set</tt> and <tt>List</tt>. This interface
|
||||
* specific subinterfaces like {@code Set} and {@code List}. This interface
|
||||
* is typically used to pass collections around and manipulate them where
|
||||
* maximum generality is desired.
|
||||
*
|
||||
* <p><i>Bags</i> or <i>multisets</i> (unordered collections that may contain
|
||||
* duplicate elements) should implement this interface directly.
|
||||
*
|
||||
* <p>All general-purpose <tt>Collection</tt> implementation classes (which
|
||||
* typically implement <tt>Collection</tt> indirectly through one of its
|
||||
* <p>All general-purpose {@code Collection} implementation classes (which
|
||||
* typically implement {@code Collection} indirectly through one of its
|
||||
* subinterfaces) should provide two "standard" constructors: a void (no
|
||||
* arguments) constructor, which creates an empty collection, and a
|
||||
* constructor with a single argument of type <tt>Collection</tt>, which
|
||||
* constructor with a single argument of type {@code Collection}, which
|
||||
* creates a new collection with the same elements as its argument. In
|
||||
* effect, the latter constructor allows the user to copy any collection,
|
||||
* producing an equivalent collection of the desired implementation type.
|
||||
* There is no way to enforce this convention (as interfaces cannot contain
|
||||
* constructors) but all of the general-purpose <tt>Collection</tt>
|
||||
* constructors) but all of the general-purpose {@code Collection}
|
||||
* implementations in the Java platform libraries comply.
|
||||
*
|
||||
* <p>The "destructive" methods contained in this interface, that is, the
|
||||
* methods that modify the collection on which they operate, are specified to
|
||||
* throw <tt>UnsupportedOperationException</tt> if this collection does not
|
||||
* throw {@code UnsupportedOperationException} if this collection does not
|
||||
* support the operation. If this is the case, these methods may, but are not
|
||||
* required to, throw an <tt>UnsupportedOperationException</tt> if the
|
||||
* required to, throw an {@code UnsupportedOperationException} if the
|
||||
* invocation would have no effect on the collection. For example, invoking
|
||||
* the {@link #addAll(Collection)} method on an unmodifiable collection may,
|
||||
* but is not required to, throw the exception if the collection to be added
|
||||
@ -69,7 +69,7 @@ import java.util.stream.StreamSupport;
|
||||
* they may contain.</a> For example, some implementations prohibit null elements,
|
||||
* and some have restrictions on the types of their elements. Attempting to
|
||||
* add an ineligible element throws an unchecked exception, typically
|
||||
* <tt>NullPointerException</tt> or <tt>ClassCastException</tt>. Attempting
|
||||
* {@code NullPointerException} or {@code ClassCastException}. Attempting
|
||||
* to query the presence of an ineligible element may throw an exception,
|
||||
* or it may simply return false; some implementations will exhibit the former
|
||||
* behavior and some will exhibit the latter. More generally, attempting an
|
||||
@ -90,13 +90,13 @@ import java.util.stream.StreamSupport;
|
||||
* <p>Many methods in Collections Framework interfaces are defined in
|
||||
* terms of the {@link Object#equals(Object) equals} method. For example,
|
||||
* the specification for the {@link #contains(Object) contains(Object o)}
|
||||
* method says: "returns <tt>true</tt> if and only if this collection
|
||||
* contains at least one element <tt>e</tt> such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>." This specification should
|
||||
* <i>not</i> be construed to imply that invoking <tt>Collection.contains</tt>
|
||||
* with a non-null argument <tt>o</tt> will cause <tt>o.equals(e)</tt> to be
|
||||
* invoked for any element <tt>e</tt>. Implementations are free to implement
|
||||
* optimizations whereby the <tt>equals</tt> invocation is avoided, for
|
||||
* method says: "returns {@code true} if and only if this collection
|
||||
* contains at least one element {@code e} such that
|
||||
* {@code (o==null ? e==null : o.equals(e))}." This specification should
|
||||
* <i>not</i> be construed to imply that invoking {@code Collection.contains}
|
||||
* with a non-null argument {@code o} will cause {@code o.equals(e)} to be
|
||||
* invoked for any element {@code e}. Implementations are free to implement
|
||||
* optimizations whereby the {@code equals} invocation is avoided, for
|
||||
* example, by first comparing the hash codes of the two elements. (The
|
||||
* {@link Object#hashCode()} specification guarantees that two objects with
|
||||
* unequal hash codes cannot be equal.) More generally, implementations of
|
||||
@ -146,28 +146,28 @@ public interface Collection<E> extends Iterable<E> {
|
||||
|
||||
/**
|
||||
* Returns the number of elements in this collection. If this collection
|
||||
* contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
|
||||
* <tt>Integer.MAX_VALUE</tt>.
|
||||
* contains more than {@code Integer.MAX_VALUE} elements, returns
|
||||
* {@code Integer.MAX_VALUE}.
|
||||
*
|
||||
* @return the number of elements in this collection
|
||||
*/
|
||||
int size();
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this collection contains no elements.
|
||||
* Returns {@code true} if this collection contains no elements.
|
||||
*
|
||||
* @return <tt>true</tt> if this collection contains no elements
|
||||
* @return {@code true} if this collection contains no elements
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this collection contains the specified element.
|
||||
* More formally, returns <tt>true</tt> if and only if this collection
|
||||
* contains at least one element <tt>e</tt> such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>.
|
||||
* Returns {@code true} if this collection contains the specified element.
|
||||
* More formally, returns {@code true} if and only if this collection
|
||||
* contains at least one element {@code e} such that
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param o element whose presence in this collection is to be tested
|
||||
* @return <tt>true</tt> if this collection contains the specified
|
||||
* @return {@code true} if this collection contains the specified
|
||||
* element
|
||||
* @throws ClassCastException if the type of the specified element
|
||||
* is incompatible with this collection
|
||||
@ -184,7 +184,7 @@ public interface Collection<E> extends Iterable<E> {
|
||||
* (unless this collection is an instance of some class that provides a
|
||||
* guarantee).
|
||||
*
|
||||
* @return an <tt>Iterator</tt> over the elements in this collection
|
||||
* @return an {@code Iterator} over the elements in this collection
|
||||
*/
|
||||
Iterator<E> iterator();
|
||||
|
||||
@ -216,9 +216,9 @@ public interface Collection<E> extends Iterable<E> {
|
||||
* <p>If this collection fits in the specified array with room to spare
|
||||
* (i.e., the array has more elements than this collection), the element
|
||||
* in the array immediately following the end of the collection is set to
|
||||
* <tt>null</tt>. (This is useful in determining the length of this
|
||||
* {@code null}. (This is useful in determining the length of this
|
||||
* collection <i>only</i> if the caller knows that this collection does
|
||||
* not contain any <tt>null</tt> elements.)
|
||||
* not contain any {@code null} elements.)
|
||||
*
|
||||
* <p>If this collection makes any guarantees as to what order its elements
|
||||
* are returned by its iterator, this method must return the elements in
|
||||
@ -229,15 +229,15 @@ public interface Collection<E> extends Iterable<E> {
|
||||
* precise control over the runtime type of the output array, and may,
|
||||
* under certain circumstances, be used to save allocation costs.
|
||||
*
|
||||
* <p>Suppose <tt>x</tt> is a collection known to contain only strings.
|
||||
* <p>Suppose {@code x} is a collection known to contain only strings.
|
||||
* The following code can be used to dump the collection into a newly
|
||||
* allocated array of <tt>String</tt>:
|
||||
* allocated array of {@code String}:
|
||||
*
|
||||
* <pre>
|
||||
* String[] y = x.toArray(new String[0]);</pre>
|
||||
*
|
||||
* Note that <tt>toArray(new Object[0])</tt> is identical in function to
|
||||
* <tt>toArray()</tt>.
|
||||
* Note that {@code toArray(new Object[0])} is identical in function to
|
||||
* {@code toArray()}.
|
||||
*
|
||||
* @param <T> the runtime type of the array to contain the collection
|
||||
* @param a the array into which the elements of this collection are to be
|
||||
@ -255,27 +255,27 @@ public interface Collection<E> extends Iterable<E> {
|
||||
|
||||
/**
|
||||
* Ensures that this collection contains the specified element (optional
|
||||
* operation). Returns <tt>true</tt> if this collection changed as a
|
||||
* result of the call. (Returns <tt>false</tt> if this collection does
|
||||
* operation). Returns {@code true} if this collection changed as a
|
||||
* result of the call. (Returns {@code false} if this collection does
|
||||
* not permit duplicates and already contains the specified element.)<p>
|
||||
*
|
||||
* Collections that support this operation may place limitations on what
|
||||
* elements may be added to this collection. In particular, some
|
||||
* collections will refuse to add <tt>null</tt> elements, and others will
|
||||
* collections will refuse to add {@code null} elements, and others will
|
||||
* impose restrictions on the type of elements that may be added.
|
||||
* Collection classes should clearly specify in their documentation any
|
||||
* restrictions on what elements may be added.<p>
|
||||
*
|
||||
* If a collection refuses to add a particular element for any reason
|
||||
* other than that it already contains the element, it <i>must</i> throw
|
||||
* an exception (rather than returning <tt>false</tt>). This preserves
|
||||
* an exception (rather than returning {@code false}). This preserves
|
||||
* the invariant that a collection always contains the specified element
|
||||
* after this call returns.
|
||||
*
|
||||
* @param e element whose presence in this collection is to be ensured
|
||||
* @return <tt>true</tt> if this collection changed as a result of the
|
||||
* @return {@code true} if this collection changed as a result of the
|
||||
* call
|
||||
* @throws UnsupportedOperationException if the <tt>add</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code add} operation
|
||||
* is not supported by this collection
|
||||
* @throws ClassCastException if the class of the specified element
|
||||
* prevents it from being added to this collection
|
||||
@ -291,21 +291,21 @@ public interface Collection<E> extends Iterable<E> {
|
||||
/**
|
||||
* Removes a single instance of the specified element from this
|
||||
* collection, if it is present (optional operation). More formally,
|
||||
* removes an element <tt>e</tt> such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>, if
|
||||
* removes an element {@code e} such that
|
||||
* {@code Objects.equals(o, e)}, if
|
||||
* this collection contains one or more such elements. Returns
|
||||
* <tt>true</tt> if this collection contained the specified element (or
|
||||
* {@code true} if this collection contained the specified element (or
|
||||
* equivalently, if this collection changed as a result of the call).
|
||||
*
|
||||
* @param o element to be removed from this collection, if present
|
||||
* @return <tt>true</tt> if an element was removed as a result of this call
|
||||
* @return {@code true} if an element was removed as a result of this call
|
||||
* @throws ClassCastException if the type of the specified element
|
||||
* is incompatible with this collection
|
||||
* (<a href="#optional-restrictions">optional</a>)
|
||||
* @throws NullPointerException if the specified element is null and this
|
||||
* collection does not permit null elements
|
||||
* (<a href="#optional-restrictions">optional</a>)
|
||||
* @throws UnsupportedOperationException if the <tt>remove</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code remove} operation
|
||||
* is not supported by this collection
|
||||
*/
|
||||
boolean remove(Object o);
|
||||
@ -314,11 +314,11 @@ public interface Collection<E> extends Iterable<E> {
|
||||
// Bulk Operations
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this collection contains all of the elements
|
||||
* Returns {@code true} if this collection contains all of the elements
|
||||
* in the specified collection.
|
||||
*
|
||||
* @param c collection to be checked for containment in this collection
|
||||
* @return <tt>true</tt> if this collection contains all of the elements
|
||||
* @return {@code true} if this collection contains all of the elements
|
||||
* in the specified collection
|
||||
* @throws ClassCastException if the types of one or more elements
|
||||
* in the specified collection are incompatible with this
|
||||
@ -342,8 +342,8 @@ public interface Collection<E> extends Iterable<E> {
|
||||
* nonempty.)
|
||||
*
|
||||
* @param c collection containing elements to be added to this collection
|
||||
* @return <tt>true</tt> if this collection changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>addAll</tt> operation
|
||||
* @return {@code true} if this collection changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code addAll} operation
|
||||
* is not supported by this collection
|
||||
* @throws ClassCastException if the class of an element of the specified
|
||||
* collection prevents it from being added to this collection
|
||||
@ -366,9 +366,9 @@ public interface Collection<E> extends Iterable<E> {
|
||||
* collection.
|
||||
*
|
||||
* @param c collection containing elements to be removed from this collection
|
||||
* @return <tt>true</tt> if this collection changed as a result of the
|
||||
* @return {@code true} if this collection changed as a result of the
|
||||
* call
|
||||
* @throws UnsupportedOperationException if the <tt>removeAll</tt> method
|
||||
* @throws UnsupportedOperationException if the {@code removeAll} method
|
||||
* is not supported by this collection
|
||||
* @throws ClassCastException if the types of one or more elements
|
||||
* in this collection are incompatible with the specified
|
||||
@ -426,8 +426,8 @@ public interface Collection<E> extends Iterable<E> {
|
||||
* specified collection.
|
||||
*
|
||||
* @param c collection containing elements to be retained in this collection
|
||||
* @return <tt>true</tt> if this collection changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>retainAll</tt> operation
|
||||
* @return {@code true} if this collection changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code retainAll} operation
|
||||
* is not supported by this collection
|
||||
* @throws ClassCastException if the types of one or more elements
|
||||
* in this collection are incompatible with the specified
|
||||
@ -447,7 +447,7 @@ public interface Collection<E> extends Iterable<E> {
|
||||
* Removes all of the elements from this collection (optional operation).
|
||||
* The collection will be empty after this method returns.
|
||||
*
|
||||
* @throws UnsupportedOperationException if the <tt>clear</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code clear} operation
|
||||
* is not supported by this collection
|
||||
*/
|
||||
void clear();
|
||||
@ -458,30 +458,30 @@ public interface Collection<E> extends Iterable<E> {
|
||||
/**
|
||||
* Compares the specified object with this collection for equality. <p>
|
||||
*
|
||||
* While the <tt>Collection</tt> interface adds no stipulations to the
|
||||
* general contract for the <tt>Object.equals</tt>, programmers who
|
||||
* implement the <tt>Collection</tt> interface "directly" (in other words,
|
||||
* create a class that is a <tt>Collection</tt> but is not a <tt>Set</tt>
|
||||
* or a <tt>List</tt>) must exercise care if they choose to override the
|
||||
* <tt>Object.equals</tt>. It is not necessary to do so, and the simplest
|
||||
* course of action is to rely on <tt>Object</tt>'s implementation, but
|
||||
* While the {@code Collection} interface adds no stipulations to the
|
||||
* general contract for the {@code Object.equals}, programmers who
|
||||
* implement the {@code Collection} interface "directly" (in other words,
|
||||
* create a class that is a {@code Collection} but is not a {@code Set}
|
||||
* or a {@code List}) must exercise care if they choose to override the
|
||||
* {@code Object.equals}. It is not necessary to do so, and the simplest
|
||||
* course of action is to rely on {@code Object}'s implementation, but
|
||||
* the implementor may wish to implement a "value comparison" in place of
|
||||
* the default "reference comparison." (The <tt>List</tt> and
|
||||
* <tt>Set</tt> interfaces mandate such value comparisons.)<p>
|
||||
* the default "reference comparison." (The {@code List} and
|
||||
* {@code Set} interfaces mandate such value comparisons.)<p>
|
||||
*
|
||||
* The general contract for the <tt>Object.equals</tt> method states that
|
||||
* equals must be symmetric (in other words, <tt>a.equals(b)</tt> if and
|
||||
* only if <tt>b.equals(a)</tt>). The contracts for <tt>List.equals</tt>
|
||||
* and <tt>Set.equals</tt> state that lists are only equal to other lists,
|
||||
* and sets to other sets. Thus, a custom <tt>equals</tt> method for a
|
||||
* collection class that implements neither the <tt>List</tt> nor
|
||||
* <tt>Set</tt> interface must return <tt>false</tt> when this collection
|
||||
* The general contract for the {@code Object.equals} method states that
|
||||
* equals must be symmetric (in other words, {@code a.equals(b)} if and
|
||||
* only if {@code b.equals(a)}). The contracts for {@code List.equals}
|
||||
* and {@code Set.equals} state that lists are only equal to other lists,
|
||||
* and sets to other sets. Thus, a custom {@code equals} method for a
|
||||
* collection class that implements neither the {@code List} nor
|
||||
* {@code Set} interface must return {@code false} when this collection
|
||||
* is compared to any list or set. (By the same logic, it is not possible
|
||||
* to write a class that correctly implements both the <tt>Set</tt> and
|
||||
* <tt>List</tt> interfaces.)
|
||||
* to write a class that correctly implements both the {@code Set} and
|
||||
* {@code List} interfaces.)
|
||||
*
|
||||
* @param o object to be compared for equality with this collection
|
||||
* @return <tt>true</tt> if the specified object is equal to this
|
||||
* @return {@code true} if the specified object is equal to this
|
||||
* collection
|
||||
*
|
||||
* @see Object#equals(Object)
|
||||
@ -492,13 +492,13 @@ public interface Collection<E> extends Iterable<E> {
|
||||
|
||||
/**
|
||||
* Returns the hash code value for this collection. While the
|
||||
* <tt>Collection</tt> interface adds no stipulations to the general
|
||||
* contract for the <tt>Object.hashCode</tt> method, programmers should
|
||||
* take note that any class that overrides the <tt>Object.equals</tt>
|
||||
* method must also override the <tt>Object.hashCode</tt> method in order
|
||||
* to satisfy the general contract for the <tt>Object.hashCode</tt> method.
|
||||
* In particular, <tt>c1.equals(c2)</tt> implies that
|
||||
* <tt>c1.hashCode()==c2.hashCode()</tt>.
|
||||
* {@code Collection} interface adds no stipulations to the general
|
||||
* contract for the {@code Object.hashCode} method, programmers should
|
||||
* take note that any class that overrides the {@code Object.equals}
|
||||
* method must also override the {@code Object.hashCode} method in order
|
||||
* to satisfy the general contract for the {@code Object.hashCode} method.
|
||||
* In particular, {@code c1.equals(c2)} implies that
|
||||
* {@code c1.hashCode()==c2.hashCode()}.
|
||||
*
|
||||
* @return the hash code value for this collection
|
||||
*
|
||||
|
||||
@ -44,7 +44,7 @@ import java.util.stream.StreamSupport;
|
||||
* collections, "wrappers", which return a new collection backed by a
|
||||
* specified collection, and a few other odds and ends.
|
||||
*
|
||||
* <p>The methods of this class all throw a <tt>NullPointerException</tt>
|
||||
* <p>The methods of this class all throw a {@code NullPointerException}
|
||||
* if the collections or class objects provided to them are null.
|
||||
*
|
||||
* <p>The documentation for the polymorphic algorithms contained in this class
|
||||
@ -52,17 +52,17 @@ import java.util.stream.StreamSupport;
|
||||
* descriptions should be regarded as <i>implementation notes</i>, rather than
|
||||
* parts of the <i>specification</i>. Implementors should feel free to
|
||||
* substitute other algorithms, so long as the specification itself is adhered
|
||||
* to. (For example, the algorithm used by <tt>sort</tt> does not have to be
|
||||
* to. (For example, the algorithm used by {@code sort} does not have to be
|
||||
* a mergesort, but it does have to be <i>stable</i>.)
|
||||
*
|
||||
* <p>The "destructive" algorithms contained in this class, that is, the
|
||||
* algorithms that modify the collection on which they operate, are specified
|
||||
* to throw <tt>UnsupportedOperationException</tt> if the collection does not
|
||||
* support the appropriate mutation primitive(s), such as the <tt>set</tt>
|
||||
* to throw {@code UnsupportedOperationException} if the collection does not
|
||||
* support the appropriate mutation primitive(s), such as the {@code set}
|
||||
* method. These algorithms may, but are not required to, throw this
|
||||
* exception if an invocation would have no effect on the collection. For
|
||||
* example, invoking the <tt>sort</tt> method on an unmodifiable list that is
|
||||
* already sorted may or may not throw <tt>UnsupportedOperationException</tt>.
|
||||
* example, invoking the {@code sort} method on an unmodifiable list that is
|
||||
* already sorted may or may not throw {@code UnsupportedOperationException}.
|
||||
*
|
||||
* <p>This class is a member of the
|
||||
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
|
||||
@ -195,10 +195,10 @@ public class Collections {
|
||||
* @param list the list to be searched.
|
||||
* @param key the key to be searched for.
|
||||
* @return the index of the search key, if it is contained in the list;
|
||||
* otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The
|
||||
* otherwise, <code>(-(<i>insertion point</i>) - 1)</code>. The
|
||||
* <i>insertion point</i> is defined as the point at which the
|
||||
* key would be inserted into the list: the index of the first
|
||||
* element greater than the key, or <tt>list.size()</tt> if all
|
||||
* element greater than the key, or {@code list.size()} if all
|
||||
* elements in the list are less than the specified key. Note
|
||||
* that this guarantees that the return value will be >= 0 if
|
||||
* and only if the key is found.
|
||||
@ -296,13 +296,13 @@ public class Collections {
|
||||
* @param list the list to be searched.
|
||||
* @param key the key to be searched for.
|
||||
* @param c the comparator by which the list is ordered.
|
||||
* A <tt>null</tt> value indicates that the elements'
|
||||
* A {@code null} value indicates that the elements'
|
||||
* {@linkplain Comparable natural ordering} should be used.
|
||||
* @return the index of the search key, if it is contained in the list;
|
||||
* otherwise, <tt>(-(<i>insertion point</i>) - 1)</tt>. The
|
||||
* otherwise, <code>(-(<i>insertion point</i>) - 1)</code>. The
|
||||
* <i>insertion point</i> is defined as the point at which the
|
||||
* key would be inserted into the list: the index of the first
|
||||
* element greater than the key, or <tt>list.size()</tt> if all
|
||||
* element greater than the key, or {@code list.size()} if all
|
||||
* elements in the list are less than the specified key. Note
|
||||
* that this guarantees that the return value will be >= 0 if
|
||||
* and only if the key is found.
|
||||
@ -368,7 +368,7 @@ public class Collections {
|
||||
*
|
||||
* @param list the list whose elements are to be reversed.
|
||||
* @throws UnsupportedOperationException if the specified list or
|
||||
* its list-iterator does not support the <tt>set</tt> operation.
|
||||
* its list-iterator does not support the {@code set} operation.
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void reverse(List<?> list) {
|
||||
@ -416,7 +416,7 @@ public class Collections {
|
||||
*
|
||||
* @param list the list to be shuffled.
|
||||
* @throws UnsupportedOperationException if the specified list or
|
||||
* its list-iterator does not support the <tt>set</tt> operation.
|
||||
* its list-iterator does not support the {@code set} operation.
|
||||
*/
|
||||
public static void shuffle(List<?> list) {
|
||||
Random rnd = r;
|
||||
@ -448,7 +448,7 @@ public class Collections {
|
||||
* @param list the list to be shuffled.
|
||||
* @param rnd the source of randomness to use to shuffle the list.
|
||||
* @throws UnsupportedOperationException if the specified list or its
|
||||
* list-iterator does not support the <tt>set</tt> operation.
|
||||
* list-iterator does not support the {@code set} operation.
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void shuffle(List<?> list, Random rnd) {
|
||||
@ -483,7 +483,7 @@ public class Collections {
|
||||
* @param list The list in which to swap elements.
|
||||
* @param i the index of one element to be swapped.
|
||||
* @param j the index of the other element to be swapped.
|
||||
* @throws IndexOutOfBoundsException if either <tt>i</tt> or <tt>j</tt>
|
||||
* @throws IndexOutOfBoundsException if either {@code i} or {@code j}
|
||||
* is out of range (i < 0 || i >= list.size()
|
||||
* || j < 0 || j >= list.size()).
|
||||
* @since 1.4
|
||||
@ -516,7 +516,7 @@ public class Collections {
|
||||
* @param list the list to be filled with the specified element.
|
||||
* @param obj The element with which to fill the specified list.
|
||||
* @throws UnsupportedOperationException if the specified list or its
|
||||
* list-iterator does not support the <tt>set</tt> operation.
|
||||
* list-iterator does not support the {@code set} operation.
|
||||
*/
|
||||
public static <T> void fill(List<? super T> list, T obj) {
|
||||
int size = list.size();
|
||||
@ -548,7 +548,7 @@ public class Collections {
|
||||
* @throws IndexOutOfBoundsException if the destination list is too small
|
||||
* to contain the entire source List.
|
||||
* @throws UnsupportedOperationException if the destination list's
|
||||
* list-iterator does not support the <tt>set</tt> operation.
|
||||
* list-iterator does not support the {@code set} operation.
|
||||
*/
|
||||
public static <T> void copy(List<? super T> dest, List<? extends T> src) {
|
||||
int srcSize = src.size();
|
||||
@ -572,11 +572,11 @@ public class Collections {
|
||||
/**
|
||||
* Returns the minimum element of the given collection, according to the
|
||||
* <i>natural ordering</i> of its elements. All elements in the
|
||||
* collection must implement the <tt>Comparable</tt> interface.
|
||||
* collection must implement the {@code Comparable} interface.
|
||||
* Furthermore, all elements in the collection must be <i>mutually
|
||||
* comparable</i> (that is, <tt>e1.compareTo(e2)</tt> must not throw a
|
||||
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and
|
||||
* <tt>e2</tt> in the collection).<p>
|
||||
* comparable</i> (that is, {@code e1.compareTo(e2)} must not throw a
|
||||
* {@code ClassCastException} for any elements {@code e1} and
|
||||
* {@code e2} in the collection).<p>
|
||||
*
|
||||
* This method iterates over the entire collection, hence it requires
|
||||
* time proportional to the size of the collection.
|
||||
@ -607,9 +607,9 @@ public class Collections {
|
||||
* Returns the minimum element of the given collection, according to the
|
||||
* order induced by the specified comparator. All elements in the
|
||||
* collection must be <i>mutually comparable</i> by the specified
|
||||
* comparator (that is, <tt>comp.compare(e1, e2)</tt> must not throw a
|
||||
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and
|
||||
* <tt>e2</tt> in the collection).<p>
|
||||
* comparator (that is, {@code comp.compare(e1, e2)} must not throw a
|
||||
* {@code ClassCastException} for any elements {@code e1} and
|
||||
* {@code e2} in the collection).<p>
|
||||
*
|
||||
* This method iterates over the entire collection, hence it requires
|
||||
* time proportional to the size of the collection.
|
||||
@ -617,7 +617,7 @@ public class Collections {
|
||||
* @param <T> the class of the objects in the collection
|
||||
* @param coll the collection whose minimum element is to be determined.
|
||||
* @param comp the comparator with which to determine the minimum element.
|
||||
* A <tt>null</tt> value indicates that the elements' <i>natural
|
||||
* A {@code null} value indicates that the elements' <i>natural
|
||||
* ordering</i> should be used.
|
||||
* @return the minimum element of the given collection, according
|
||||
* to the specified comparator.
|
||||
@ -645,11 +645,11 @@ public class Collections {
|
||||
/**
|
||||
* Returns the maximum element of the given collection, according to the
|
||||
* <i>natural ordering</i> of its elements. All elements in the
|
||||
* collection must implement the <tt>Comparable</tt> interface.
|
||||
* collection must implement the {@code Comparable} interface.
|
||||
* Furthermore, all elements in the collection must be <i>mutually
|
||||
* comparable</i> (that is, <tt>e1.compareTo(e2)</tt> must not throw a
|
||||
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and
|
||||
* <tt>e2</tt> in the collection).<p>
|
||||
* comparable</i> (that is, {@code e1.compareTo(e2)} must not throw a
|
||||
* {@code ClassCastException} for any elements {@code e1} and
|
||||
* {@code e2} in the collection).<p>
|
||||
*
|
||||
* This method iterates over the entire collection, hence it requires
|
||||
* time proportional to the size of the collection.
|
||||
@ -680,9 +680,9 @@ public class Collections {
|
||||
* Returns the maximum element of the given collection, according to the
|
||||
* order induced by the specified comparator. All elements in the
|
||||
* collection must be <i>mutually comparable</i> by the specified
|
||||
* comparator (that is, <tt>comp.compare(e1, e2)</tt> must not throw a
|
||||
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and
|
||||
* <tt>e2</tt> in the collection).<p>
|
||||
* comparator (that is, {@code comp.compare(e1, e2)} must not throw a
|
||||
* {@code ClassCastException} for any elements {@code e1} and
|
||||
* {@code e2} in the collection).<p>
|
||||
*
|
||||
* This method iterates over the entire collection, hence it requires
|
||||
* time proportional to the size of the collection.
|
||||
@ -690,7 +690,7 @@ public class Collections {
|
||||
* @param <T> the class of the objects in the collection
|
||||
* @param coll the collection whose maximum element is to be determined.
|
||||
* @param comp the comparator with which to determine the maximum element.
|
||||
* A <tt>null</tt> value indicates that the elements' <i>natural
|
||||
* A {@code null} value indicates that the elements' <i>natural
|
||||
* ordering</i> should be used.
|
||||
* @return the maximum element of the given collection, according
|
||||
* to the specified comparator.
|
||||
@ -717,32 +717,32 @@ public class Collections {
|
||||
|
||||
/**
|
||||
* Rotates the elements in the specified list by the specified distance.
|
||||
* After calling this method, the element at index <tt>i</tt> will be
|
||||
* the element previously at index <tt>(i - distance)</tt> mod
|
||||
* <tt>list.size()</tt>, for all values of <tt>i</tt> between <tt>0</tt>
|
||||
* and <tt>list.size()-1</tt>, inclusive. (This method has no effect on
|
||||
* After calling this method, the element at index {@code i} will be
|
||||
* the element previously at index {@code (i - distance)} mod
|
||||
* {@code list.size()}, for all values of {@code i} between {@code 0}
|
||||
* and {@code list.size()-1}, inclusive. (This method has no effect on
|
||||
* the size of the list.)
|
||||
*
|
||||
* <p>For example, suppose <tt>list</tt> comprises<tt> [t, a, n, k, s]</tt>.
|
||||
* After invoking <tt>Collections.rotate(list, 1)</tt> (or
|
||||
* <tt>Collections.rotate(list, -4)</tt>), <tt>list</tt> will comprise
|
||||
* <tt>[s, t, a, n, k]</tt>.
|
||||
* <p>For example, suppose {@code list} comprises{@code [t, a, n, k, s]}.
|
||||
* After invoking {@code Collections.rotate(list, 1)} (or
|
||||
* {@code Collections.rotate(list, -4)}), {@code list} will comprise
|
||||
* {@code [s, t, a, n, k]}.
|
||||
*
|
||||
* <p>Note that this method can usefully be applied to sublists to
|
||||
* move one or more elements within a list while preserving the
|
||||
* order of the remaining elements. For example, the following idiom
|
||||
* moves the element at index <tt>j</tt> forward to position
|
||||
* <tt>k</tt> (which must be greater than or equal to <tt>j</tt>):
|
||||
* moves the element at index {@code j} forward to position
|
||||
* {@code k} (which must be greater than or equal to {@code j}):
|
||||
* <pre>
|
||||
* Collections.rotate(list.subList(j, k+1), -1);
|
||||
* </pre>
|
||||
* To make this concrete, suppose <tt>list</tt> comprises
|
||||
* <tt>[a, b, c, d, e]</tt>. To move the element at index <tt>1</tt>
|
||||
* (<tt>b</tt>) forward two positions, perform the following invocation:
|
||||
* To make this concrete, suppose {@code list} comprises
|
||||
* {@code [a, b, c, d, e]}. To move the element at index {@code 1}
|
||||
* ({@code b}) forward two positions, perform the following invocation:
|
||||
* <pre>
|
||||
* Collections.rotate(l.subList(1, 4), -1);
|
||||
* </pre>
|
||||
* The resulting list is <tt>[a, c, d, b, e]</tt>.
|
||||
* The resulting list is {@code [a, c, d, b, e]}.
|
||||
*
|
||||
* <p>To move more than one element forward, increase the absolute value
|
||||
* of the rotation distance. To move elements backward, use a positive
|
||||
@ -755,8 +755,8 @@ public class Collections {
|
||||
* element is swapped into the first element. If necessary, the process
|
||||
* is repeated on the second and successive elements, until the rotation
|
||||
* is complete. If the specified list is large and doesn't implement the
|
||||
* <tt>RandomAccess</tt> interface, this implementation breaks the
|
||||
* list into two sublist views around index <tt>-distance mod size</tt>.
|
||||
* {@code RandomAccess} interface, this implementation breaks the
|
||||
* list into two sublist views around index {@code -distance mod size}.
|
||||
* Then the {@link #reverse(List)} method is invoked on each sublist view,
|
||||
* and finally it is invoked on the entire list. For a more complete
|
||||
* description of both algorithms, see Section 2.3 of Jon Bentley's
|
||||
@ -765,9 +765,9 @@ public class Collections {
|
||||
* @param list the list to be rotated.
|
||||
* @param distance the distance to rotate the list. There are no
|
||||
* constraints on this value; it may be zero, negative, or
|
||||
* greater than <tt>list.size()</tt>.
|
||||
* greater than {@code list.size()}.
|
||||
* @throws UnsupportedOperationException if the specified list or
|
||||
* its list-iterator does not support the <tt>set</tt> operation.
|
||||
* its list-iterator does not support the {@code set} operation.
|
||||
* @since 1.4
|
||||
*/
|
||||
public static void rotate(List<?> list, int distance) {
|
||||
@ -817,21 +817,21 @@ public class Collections {
|
||||
|
||||
/**
|
||||
* Replaces all occurrences of one specified value in a list with another.
|
||||
* More formally, replaces with <tt>newVal</tt> each element <tt>e</tt>
|
||||
* in <tt>list</tt> such that
|
||||
* <tt>(oldVal==null ? e==null : oldVal.equals(e))</tt>.
|
||||
* More formally, replaces with {@code newVal} each element {@code e}
|
||||
* in {@code list} such that
|
||||
* {@code (oldVal==null ? e==null : oldVal.equals(e))}.
|
||||
* (This method has no effect on the size of the list.)
|
||||
*
|
||||
* @param <T> the class of the objects in the list
|
||||
* @param list the list in which replacement is to occur.
|
||||
* @param oldVal the old value to be replaced.
|
||||
* @param newVal the new value with which <tt>oldVal</tt> is to be
|
||||
* @param newVal the new value with which {@code oldVal} is to be
|
||||
* replaced.
|
||||
* @return <tt>true</tt> if <tt>list</tt> contained one or more elements
|
||||
* <tt>e</tt> such that
|
||||
* <tt>(oldVal==null ? e==null : oldVal.equals(e))</tt>.
|
||||
* @return {@code true} if {@code list} contained one or more elements
|
||||
* {@code e} such that
|
||||
* {@code (oldVal==null ? e==null : oldVal.equals(e))}.
|
||||
* @throws UnsupportedOperationException if the specified list or
|
||||
* its list-iterator does not support the <tt>set</tt> operation.
|
||||
* its list-iterator does not support the {@code set} operation.
|
||||
* @since 1.4
|
||||
*/
|
||||
public static <T> boolean replaceAll(List<T> list, T oldVal, T newVal) {
|
||||
@ -877,7 +877,7 @@ public class Collections {
|
||||
/**
|
||||
* Returns the starting position of the first occurrence of the specified
|
||||
* target list within the specified source list, or -1 if there is no
|
||||
* such occurrence. More formally, returns the lowest index <tt>i</tt>
|
||||
* such occurrence. More formally, returns the lowest index {@code i}
|
||||
* such that {@code source.subList(i, i+target.size()).equals(target)},
|
||||
* or -1 if there is no such index. (Returns -1 if
|
||||
* {@code target.size() > source.size()})
|
||||
@ -887,8 +887,8 @@ public class Collections {
|
||||
* location in turn.
|
||||
*
|
||||
* @param source the list in which to search for the first occurrence
|
||||
* of <tt>target</tt>.
|
||||
* @param target the list to search for as a subList of <tt>source</tt>.
|
||||
* of {@code target}.
|
||||
* @param target the list to search for as a subList of {@code source}.
|
||||
* @return the starting position of the first occurrence of the specified
|
||||
* target list within the specified source list, or -1 if there
|
||||
* is no such occurrence.
|
||||
@ -930,7 +930,7 @@ public class Collections {
|
||||
/**
|
||||
* Returns the starting position of the last occurrence of the specified
|
||||
* target list within the specified source list, or -1 if there is no such
|
||||
* occurrence. More formally, returns the highest index <tt>i</tt>
|
||||
* occurrence. More formally, returns the highest index {@code i}
|
||||
* such that {@code source.subList(i, i+target.size()).equals(target)},
|
||||
* or -1 if there is no such index. (Returns -1 if
|
||||
* {@code target.size() > source.size()})
|
||||
@ -940,8 +940,8 @@ public class Collections {
|
||||
* location in turn.
|
||||
*
|
||||
* @param source the list in which to search for the last occurrence
|
||||
* of <tt>target</tt>.
|
||||
* @param target the list to search for as a subList of <tt>source</tt>.
|
||||
* of {@code target}.
|
||||
* @param target the list to search for as a subList of {@code source}.
|
||||
* @return the starting position of the last occurrence of the specified
|
||||
* target list within the specified source list, or -1 if there
|
||||
* is no such occurrence.
|
||||
@ -993,11 +993,11 @@ public class Collections {
|
||||
* collections. Query operations on the returned collection "read through"
|
||||
* to the specified collection, and attempts to modify the returned
|
||||
* collection, whether direct or via its iterator, result in an
|
||||
* <tt>UnsupportedOperationException</tt>.<p>
|
||||
* {@code UnsupportedOperationException}.<p>
|
||||
*
|
||||
* The returned collection does <i>not</i> pass the hashCode and equals
|
||||
* operations through to the backing collection, but relies on
|
||||
* <tt>Object</tt>'s <tt>equals</tt> and <tt>hashCode</tt> methods. This
|
||||
* {@code Object}'s {@code equals} and {@code hashCode} methods. This
|
||||
* is necessary to preserve the contracts of these operations in the case
|
||||
* that the backing collection is a set or a list.<p>
|
||||
*
|
||||
@ -1105,7 +1105,7 @@ public class Collections {
|
||||
* modules to provide users with "read-only" access to internal sets.
|
||||
* Query operations on the returned set "read through" to the specified
|
||||
* set, and attempts to modify the returned set, whether direct or via its
|
||||
* iterator, result in an <tt>UnsupportedOperationException</tt>.<p>
|
||||
* iterator, result in an {@code UnsupportedOperationException}.<p>
|
||||
*
|
||||
* The returned set will be serializable if the specified set
|
||||
* is serializable.
|
||||
@ -1136,8 +1136,8 @@ public class Collections {
|
||||
* sorted sets. Query operations on the returned sorted set "read
|
||||
* through" to the specified sorted set. Attempts to modify the returned
|
||||
* sorted set, whether direct, via its iterator, or via its
|
||||
* <tt>subSet</tt>, <tt>headSet</tt>, or <tt>tailSet</tt> views, result in
|
||||
* an <tt>UnsupportedOperationException</tt>.<p>
|
||||
* {@code subSet}, {@code headSet}, or {@code tailSet} views, result in
|
||||
* an {@code UnsupportedOperationException}.<p>
|
||||
*
|
||||
* The returned sorted set will be serializable if the specified sorted set
|
||||
* is serializable.
|
||||
@ -1273,7 +1273,7 @@ public class Collections {
|
||||
* lists. Query operations on the returned list "read through" to the
|
||||
* specified list, and attempts to modify the returned list, whether
|
||||
* direct or via its iterator, result in an
|
||||
* <tt>UnsupportedOperationException</tt>.<p>
|
||||
* {@code UnsupportedOperationException}.<p>
|
||||
*
|
||||
* The returned list will be serializable if the specified list
|
||||
* is serializable. Similarly, the returned list will implement
|
||||
@ -1419,7 +1419,7 @@ public class Collections {
|
||||
* maps. Query operations on the returned map "read through"
|
||||
* to the specified map, and attempts to modify the returned
|
||||
* map, whether direct or via its collection views, result in an
|
||||
* <tt>UnsupportedOperationException</tt>.<p>
|
||||
* {@code UnsupportedOperationException}.<p>
|
||||
*
|
||||
* The returned map will be serializable if the specified map
|
||||
* is serializable.
|
||||
@ -1769,8 +1769,8 @@ public class Collections {
|
||||
* sorted maps. Query operations on the returned sorted map "read through"
|
||||
* to the specified sorted map. Attempts to modify the returned
|
||||
* sorted map, whether direct, via its collection views, or via its
|
||||
* <tt>subMap</tt>, <tt>headMap</tt>, or <tt>tailMap</tt> views, result in
|
||||
* an <tt>UnsupportedOperationException</tt>.<p>
|
||||
* {@code subMap}, {@code headMap}, or {@code tailMap} views, result in
|
||||
* an {@code UnsupportedOperationException}.<p>
|
||||
*
|
||||
* The returned sorted map will be serializable if the specified sorted map
|
||||
* is serializable.
|
||||
@ -2148,8 +2148,8 @@ public class Collections {
|
||||
* through the returned sorted set (or its views).<p>
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* sorted set when iterating over it or any of its <tt>subSet</tt>,
|
||||
* <tt>headSet</tt>, or <tt>tailSet</tt> views.
|
||||
* sorted set when iterating over it or any of its {@code subSet},
|
||||
* {@code headSet}, or {@code tailSet} views.
|
||||
* <pre>
|
||||
* SortedSet s = Collections.synchronizedSortedSet(new TreeSet());
|
||||
* ...
|
||||
@ -2700,8 +2700,8 @@ public class Collections {
|
||||
*
|
||||
* It is imperative that the user manually synchronize on the returned
|
||||
* sorted map when iterating over any of its collection views, or the
|
||||
* collections views of any of its <tt>subMap</tt>, <tt>headMap</tt> or
|
||||
* <tt>tailMap</tt> views.
|
||||
* collections views of any of its {@code subMap}, {@code headMap} or
|
||||
* {@code tailMap} views.
|
||||
* <pre>
|
||||
* SortedMap m = Collections.synchronizedSortedMap(new TreeMap());
|
||||
* ...
|
||||
@ -4406,7 +4406,7 @@ public class Collections {
|
||||
* </pre>
|
||||
*
|
||||
* @implNote
|
||||
* Implementations of this method need not create a separate <tt>List</tt>
|
||||
* Implementations of this method need not create a separate {@code List}
|
||||
* object for each call. Using this method is likely to have comparable
|
||||
* cost to using the like-named field. (Unlike this method, the field does
|
||||
* not provide type safety.)
|
||||
@ -4846,7 +4846,7 @@ public class Collections {
|
||||
* @param <K> the class of the map keys
|
||||
* @param <V> the class of the map values
|
||||
* @param key the sole key to be stored in the returned map.
|
||||
* @param value the value to which the returned map maps <tt>key</tt>.
|
||||
* @param value the value to which the returned map maps {@code key}.
|
||||
* @return an immutable map containing only the specified key-value
|
||||
* mapping.
|
||||
* @since 1.3
|
||||
@ -4964,17 +4964,17 @@ public class Collections {
|
||||
// Miscellaneous
|
||||
|
||||
/**
|
||||
* Returns an immutable list consisting of <tt>n</tt> copies of the
|
||||
* Returns an immutable list consisting of {@code n} copies of the
|
||||
* specified object. The newly allocated data object is tiny (it contains
|
||||
* a single reference to the data object). This method is useful in
|
||||
* combination with the <tt>List.addAll</tt> method to grow lists.
|
||||
* combination with the {@code List.addAll} method to grow lists.
|
||||
* The returned list is serializable.
|
||||
*
|
||||
* @param <T> the class of the object to copy and of the objects
|
||||
* in the returned list.
|
||||
* @param n the number of elements in the returned list.
|
||||
* @param o the element to appear repeatedly in the returned list.
|
||||
* @return an immutable list consisting of <tt>n</tt> copies of the
|
||||
* @return an immutable list consisting of {@code n} copies of the
|
||||
* specified object.
|
||||
* @throws IllegalArgumentException if {@code n < 0}
|
||||
* @see List#addAll(Collection)
|
||||
@ -5095,7 +5095,7 @@ public class Collections {
|
||||
* @param <T> the class of the objects compared by the comparator
|
||||
* @return A comparator that imposes the reverse of the <i>natural
|
||||
* ordering</i> on a collection of objects that implement
|
||||
* the <tt>Comparable</tt> interface.
|
||||
* the {@code Comparable} interface.
|
||||
* @see Comparable
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -5259,14 +5259,14 @@ public class Collections {
|
||||
/**
|
||||
* Returns the number of elements in the specified collection equal to the
|
||||
* specified object. More formally, returns the number of elements
|
||||
* <tt>e</tt> in the collection such that
|
||||
* <tt>(o == null ? e == null : o.equals(e))</tt>.
|
||||
* {@code e} in the collection such that
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param c the collection in which to determine the frequency
|
||||
* of <tt>o</tt>
|
||||
* of {@code o}
|
||||
* @param o the object whose frequency is to be determined
|
||||
* @return the number of elements in {@code c} equal to {@code o}
|
||||
* @throws NullPointerException if <tt>c</tt> is null
|
||||
* @throws NullPointerException if {@code c} is null
|
||||
* @since 1.5
|
||||
*/
|
||||
public static int frequency(Collection<?> c, Object o) {
|
||||
@ -5377,7 +5377,7 @@ public class Collections {
|
||||
* Adds all of the specified elements to the specified collection.
|
||||
* Elements to be added may be specified individually or as an array.
|
||||
* The behavior of this convenience method is identical to that of
|
||||
* <tt>c.addAll(Arrays.asList(elements))</tt>, but this method is likely
|
||||
* {@code c.addAll(Arrays.asList(elements))}, but this method is likely
|
||||
* to run significantly faster under most implementations.
|
||||
*
|
||||
* <p>When elements are specified individually, this method provides a
|
||||
@ -5387,16 +5387,16 @@ public class Collections {
|
||||
* </pre>
|
||||
*
|
||||
* @param <T> the class of the elements to add and of the collection
|
||||
* @param c the collection into which <tt>elements</tt> are to be inserted
|
||||
* @param elements the elements to insert into <tt>c</tt>
|
||||
* @return <tt>true</tt> if the collection changed as a result of the call
|
||||
* @throws UnsupportedOperationException if <tt>c</tt> does not support
|
||||
* the <tt>add</tt> operation
|
||||
* @throws NullPointerException if <tt>elements</tt> contains one or more
|
||||
* null values and <tt>c</tt> does not permit null elements, or
|
||||
* if <tt>c</tt> or <tt>elements</tt> are <tt>null</tt>
|
||||
* @param c the collection into which {@code elements} are to be inserted
|
||||
* @param elements the elements to insert into {@code c}
|
||||
* @return {@code true} if the collection changed as a result of the call
|
||||
* @throws UnsupportedOperationException if {@code c} does not support
|
||||
* the {@code add} operation
|
||||
* @throws NullPointerException if {@code elements} contains one or more
|
||||
* null values and {@code c} does not permit null elements, or
|
||||
* if {@code c} or {@code elements} are {@code null}
|
||||
* @throws IllegalArgumentException if some property of a value in
|
||||
* <tt>elements</tt> prevents it from being added to <tt>c</tt>
|
||||
* {@code elements} prevents it from being added to {@code c}
|
||||
* @see Collection#addAll(Collection)
|
||||
* @since 1.5
|
||||
*/
|
||||
@ -5418,9 +5418,9 @@ public class Collections {
|
||||
* HashMap} or {@link TreeMap}).
|
||||
*
|
||||
* <p>Each method invocation on the set returned by this method results in
|
||||
* exactly one method invocation on the backing map or its <tt>keySet</tt>
|
||||
* view, with one exception. The <tt>addAll</tt> method is implemented
|
||||
* as a sequence of <tt>put</tt> invocations on the backing map.
|
||||
* exactly one method invocation on the backing map or its {@code keySet}
|
||||
* view, with one exception. The {@code addAll} method is implemented
|
||||
* as a sequence of {@code put} invocations on the backing map.
|
||||
*
|
||||
* <p>The specified map must be empty at the time this method is invoked,
|
||||
* and should not be accessed directly after this method returns. These
|
||||
@ -5436,7 +5436,7 @@ public class Collections {
|
||||
* returned set
|
||||
* @param map the backing map
|
||||
* @return the set backed by the map
|
||||
* @throws IllegalArgumentException if <tt>map</tt> is not empty
|
||||
* @throws IllegalArgumentException if {@code map} is not empty
|
||||
* @since 1.6
|
||||
*/
|
||||
public static <E> Set<E> newSetFromMap(Map<E, Boolean> map) {
|
||||
@ -5505,10 +5505,10 @@ public class Collections {
|
||||
|
||||
/**
|
||||
* Returns a view of a {@link Deque} as a Last-in-first-out (Lifo)
|
||||
* {@link Queue}. Method <tt>add</tt> is mapped to <tt>push</tt>,
|
||||
* <tt>remove</tt> is mapped to <tt>pop</tt> and so on. This
|
||||
* {@link Queue}. Method {@code add} is mapped to {@code push},
|
||||
* {@code remove} is mapped to {@code pop} and so on. This
|
||||
* view can be useful when you would like to use a method
|
||||
* requiring a <tt>Queue</tt> but you need Lifo ordering.
|
||||
* requiring a {@code Queue} but you need Lifo ordering.
|
||||
*
|
||||
* <p>Each method invocation on the queue returned by this method
|
||||
* results in exactly one method invocation on the backing deque, with
|
||||
|
||||
@ -42,20 +42,20 @@ import java.util.Comparators;
|
||||
* SortedMap sorted maps}), or to provide an ordering for collections of
|
||||
* objects that don't have a {@link Comparable natural ordering}.<p>
|
||||
*
|
||||
* The ordering imposed by a comparator <tt>c</tt> on a set of elements
|
||||
* <tt>S</tt> is said to be <i>consistent with equals</i> if and only if
|
||||
* <tt>c.compare(e1, e2)==0</tt> has the same boolean value as
|
||||
* <tt>e1.equals(e2)</tt> for every <tt>e1</tt> and <tt>e2</tt> in
|
||||
* <tt>S</tt>.<p>
|
||||
* The ordering imposed by a comparator {@code c} on a set of elements
|
||||
* {@code S} is said to be <i>consistent with equals</i> if and only if
|
||||
* {@code c.compare(e1, e2)==0} has the same boolean value as
|
||||
* {@code e1.equals(e2)} for every {@code e1} and {@code e2} in
|
||||
* {@code S}.<p>
|
||||
*
|
||||
* Caution should be exercised when using a comparator capable of imposing an
|
||||
* ordering inconsistent with equals to order a sorted set (or sorted map).
|
||||
* Suppose a sorted set (or sorted map) with an explicit comparator <tt>c</tt>
|
||||
* is used with elements (or keys) drawn from a set <tt>S</tt>. If the
|
||||
* ordering imposed by <tt>c</tt> on <tt>S</tt> is inconsistent with equals,
|
||||
* Suppose a sorted set (or sorted map) with an explicit comparator {@code c}
|
||||
* is used with elements (or keys) drawn from a set {@code S}. If the
|
||||
* ordering imposed by {@code c} on {@code S} is inconsistent with equals,
|
||||
* the sorted set (or sorted map) will behave "strangely." In particular the
|
||||
* sorted set (or sorted map) will violate the general contract for set (or
|
||||
* map), which is defined in terms of <tt>equals</tt>.<p>
|
||||
* map), which is defined in terms of {@code equals}.<p>
|
||||
*
|
||||
* For example, suppose one adds two elements {@code a} and {@code b} such that
|
||||
* {@code (a.equals(b) && c.compare(a, b) != 0)}
|
||||
@ -67,23 +67,23 @@ import java.util.Comparators;
|
||||
* {@link Set#add Set.add} method.<p>
|
||||
*
|
||||
* Note: It is generally a good idea for comparators to also implement
|
||||
* <tt>java.io.Serializable</tt>, as they may be used as ordering methods in
|
||||
* {@code java.io.Serializable}, as they may be used as ordering methods in
|
||||
* serializable data structures (like {@link TreeSet}, {@link TreeMap}). In
|
||||
* order for the data structure to serialize successfully, the comparator (if
|
||||
* provided) must implement <tt>Serializable</tt>.<p>
|
||||
* provided) must implement {@code Serializable}.<p>
|
||||
*
|
||||
* For the mathematically inclined, the <i>relation</i> that defines the
|
||||
* <i>imposed ordering</i> that a given comparator <tt>c</tt> imposes on a
|
||||
* given set of objects <tt>S</tt> is:<pre>
|
||||
* <i>imposed ordering</i> that a given comparator {@code c} imposes on a
|
||||
* given set of objects {@code S} is:<pre>
|
||||
* {(x, y) such that c.compare(x, y) <= 0}.
|
||||
* </pre> The <i>quotient</i> for this total order is:<pre>
|
||||
* {(x, y) such that c.compare(x, y) == 0}.
|
||||
* </pre>
|
||||
*
|
||||
* It follows immediately from the contract for <tt>compare</tt> that the
|
||||
* quotient is an <i>equivalence relation</i> on <tt>S</tt>, and that the
|
||||
* imposed ordering is a <i>total order</i> on <tt>S</tt>. When we say that
|
||||
* the ordering imposed by <tt>c</tt> on <tt>S</tt> is <i>consistent with
|
||||
* It follows immediately from the contract for {@code compare} that the
|
||||
* quotient is an <i>equivalence relation</i> on {@code S}, and that the
|
||||
* imposed ordering is a <i>total order</i> on {@code S}. When we say that
|
||||
* the ordering imposed by {@code c} on {@code S} is <i>consistent with
|
||||
* equals</i>, we mean that the quotient for the ordering is the equivalence
|
||||
* relation defined by the objects' {@link Object#equals(Object)
|
||||
* equals(Object)} method(s):<pre>
|
||||
@ -113,26 +113,26 @@ public interface Comparator<T> {
|
||||
* to, or greater than the second.<p>
|
||||
*
|
||||
* In the foregoing description, the notation
|
||||
* <tt>sgn(</tt><i>expression</i><tt>)</tt> designates the mathematical
|
||||
* <i>signum</i> function, which is defined to return one of <tt>-1</tt>,
|
||||
* <tt>0</tt>, or <tt>1</tt> according to whether the value of
|
||||
* {@code sgn(}<i>expression</i>{@code )} designates the mathematical
|
||||
* <i>signum</i> function, which is defined to return one of {@code -1},
|
||||
* {@code 0}, or {@code 1} according to whether the value of
|
||||
* <i>expression</i> is negative, zero or positive.<p>
|
||||
*
|
||||
* The implementor must ensure that <tt>sgn(compare(x, y)) ==
|
||||
* -sgn(compare(y, x))</tt> for all <tt>x</tt> and <tt>y</tt>. (This
|
||||
* implies that <tt>compare(x, y)</tt> must throw an exception if and only
|
||||
* if <tt>compare(y, x)</tt> throws an exception.)<p>
|
||||
* The implementor must ensure that {@code sgn(compare(x, y)) ==
|
||||
* -sgn(compare(y, x))} for all {@code x} and {@code y}. (This
|
||||
* implies that {@code compare(x, y)} must throw an exception if and only
|
||||
* if {@code compare(y, x)} throws an exception.)<p>
|
||||
*
|
||||
* The implementor must also ensure that the relation is transitive:
|
||||
* <tt>((compare(x, y)>0) && (compare(y, z)>0))</tt> implies
|
||||
* <tt>compare(x, z)>0</tt>.<p>
|
||||
* {@code ((compare(x, y)>0) && (compare(y, z)>0))} implies
|
||||
* {@code compare(x, z)>0}.<p>
|
||||
*
|
||||
* Finally, the implementor must ensure that <tt>compare(x, y)==0</tt>
|
||||
* implies that <tt>sgn(compare(x, z))==sgn(compare(y, z))</tt> for all
|
||||
* <tt>z</tt>.<p>
|
||||
* Finally, the implementor must ensure that {@code compare(x, y)==0}
|
||||
* implies that {@code sgn(compare(x, z))==sgn(compare(y, z))} for all
|
||||
* {@code z}.<p>
|
||||
*
|
||||
* It is generally the case, but <i>not</i> strictly required that
|
||||
* <tt>(compare(x, y)==0) == (x.equals(y))</tt>. Generally speaking,
|
||||
* {@code (compare(x, y)==0) == (x.equals(y))}. Generally speaking,
|
||||
* any comparator that violates this condition should clearly indicate
|
||||
* this fact. The recommended language is "Note: this comparator
|
||||
* imposes orderings that are inconsistent with equals."
|
||||
@ -153,19 +153,19 @@ public interface Comparator<T> {
|
||||
* Indicates whether some other object is "equal to" this
|
||||
* comparator. This method must obey the general contract of
|
||||
* {@link Object#equals(Object)}. Additionally, this method can return
|
||||
* <tt>true</tt> <i>only</i> if the specified object is also a comparator
|
||||
* {@code true} <i>only</i> if the specified object is also a comparator
|
||||
* and it imposes the same ordering as this comparator. Thus,
|
||||
* <code>comp1.equals(comp2)</code> implies that <tt>sgn(comp1.compare(o1,
|
||||
* o2))==sgn(comp2.compare(o1, o2))</tt> for every object reference
|
||||
* <tt>o1</tt> and <tt>o2</tt>.<p>
|
||||
* {@code comp1.equals(comp2)} implies that {@code sgn(comp1.compare(o1,
|
||||
* o2))==sgn(comp2.compare(o1, o2))} for every object reference
|
||||
* {@code o1} and {@code o2}.<p>
|
||||
*
|
||||
* Note that it is <i>always</i> safe <i>not</i> to override
|
||||
* <tt>Object.equals(Object)</tt>. However, overriding this method may,
|
||||
* {@code Object.equals(Object)}. However, overriding this method may,
|
||||
* in some cases, improve performance by allowing programs to determine
|
||||
* that two distinct comparators impose the same order.
|
||||
*
|
||||
* @param obj the reference object with which to compare.
|
||||
* @return <code>true</code> only if the specified object is also
|
||||
* @return {@code true} only if the specified object is also
|
||||
* a comparator and it imposes the same ordering as this
|
||||
* comparator.
|
||||
* @see Object#equals(Object)
|
||||
|
||||
@ -26,14 +26,14 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* The <code>Dictionary</code> class is the abstract parent of any
|
||||
* class, such as <code>Hashtable</code>, which maps keys to values.
|
||||
* Every key and every value is an object. In any one <tt>Dictionary</tt>
|
||||
* The {@code Dictionary} class is the abstract parent of any
|
||||
* class, such as {@code Hashtable}, which maps keys to values.
|
||||
* Every key and every value is an object. In any one {@code Dictionary}
|
||||
* object, every key is associated with at most one value. Given a
|
||||
* <tt>Dictionary</tt> and a key, the associated element can be looked up.
|
||||
* Any non-<code>null</code> object can be used as a key and as a value.
|
||||
* {@code Dictionary} and a key, the associated element can be looked up.
|
||||
* Any non-{@code null} object can be used as a key and as a value.
|
||||
* <p>
|
||||
* As a rule, the <code>equals</code> method should be used by
|
||||
* As a rule, the {@code equals} method should be used by
|
||||
* implementations of this class to decide if two keys are the same.
|
||||
* <p>
|
||||
* <strong>NOTE: This class is obsolete. New implementations should
|
||||
@ -64,17 +64,17 @@ class Dictionary<K,V> {
|
||||
|
||||
/**
|
||||
* Tests if this dictionary maps no keys to value. The general contract
|
||||
* for the <tt>isEmpty</tt> method is that the result is true if and only
|
||||
* for the {@code isEmpty} method is that the result is true if and only
|
||||
* if this dictionary contains no entries.
|
||||
*
|
||||
* @return <code>true</code> if this dictionary maps no keys to values;
|
||||
* <code>false</code> otherwise.
|
||||
* @return {@code true} if this dictionary maps no keys to values;
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
abstract public boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns an enumeration of the keys in this dictionary. The general
|
||||
* contract for the keys method is that an <tt>Enumeration</tt> object
|
||||
* contract for the keys method is that an {@code Enumeration} object
|
||||
* is returned that will generate all the keys for which this dictionary
|
||||
* contains entries.
|
||||
*
|
||||
@ -86,8 +86,8 @@ class Dictionary<K,V> {
|
||||
|
||||
/**
|
||||
* Returns an enumeration of the values in this dictionary. The general
|
||||
* contract for the <tt>elements</tt> method is that an
|
||||
* <tt>Enumeration</tt> is returned that will generate all the elements
|
||||
* contract for the {@code elements} method is that an
|
||||
* {@code Enumeration} is returned that will generate all the elements
|
||||
* contained in entries in this dictionary.
|
||||
*
|
||||
* @return an enumeration of the values in this dictionary.
|
||||
@ -98,58 +98,58 @@ class Dictionary<K,V> {
|
||||
|
||||
/**
|
||||
* Returns the value to which the key is mapped in this dictionary.
|
||||
* The general contract for the <tt>isEmpty</tt> method is that if this
|
||||
* The general contract for the {@code isEmpty} method is that if this
|
||||
* dictionary contains an entry for the specified key, the associated
|
||||
* value is returned; otherwise, <tt>null</tt> is returned.
|
||||
* value is returned; otherwise, {@code null} is returned.
|
||||
*
|
||||
* @return the value to which the key is mapped in this dictionary;
|
||||
* @param key a key in this dictionary.
|
||||
* <code>null</code> if the key is not mapped to any value in
|
||||
* {@code null} if the key is not mapped to any value in
|
||||
* this dictionary.
|
||||
* @exception NullPointerException if the <tt>key</tt> is <tt>null</tt>.
|
||||
* @exception NullPointerException if the {@code key} is {@code null}.
|
||||
* @see java.util.Dictionary#put(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
abstract public V get(Object key);
|
||||
|
||||
/**
|
||||
* Maps the specified <code>key</code> to the specified
|
||||
* <code>value</code> in this dictionary. Neither the key nor the
|
||||
* value can be <code>null</code>.
|
||||
* Maps the specified {@code key} to the specified
|
||||
* {@code value} in this dictionary. Neither the key nor the
|
||||
* value can be {@code null}.
|
||||
* <p>
|
||||
* If this dictionary already contains an entry for the specified
|
||||
* <tt>key</tt>, the value already in this dictionary for that
|
||||
* <tt>key</tt> is returned, after modifying the entry to contain the
|
||||
* {@code key}, the value already in this dictionary for that
|
||||
* {@code key} is returned, after modifying the entry to contain the
|
||||
* new element. <p>If this dictionary does not already have an entry
|
||||
* for the specified <tt>key</tt>, an entry is created for the
|
||||
* specified <tt>key</tt> and <tt>value</tt>, and <tt>null</tt> is
|
||||
* for the specified {@code key}, an entry is created for the
|
||||
* specified {@code key} and {@code value}, and {@code null} is
|
||||
* returned.
|
||||
* <p>
|
||||
* The <code>value</code> can be retrieved by calling the
|
||||
* <code>get</code> method with a <code>key</code> that is equal to
|
||||
* the original <code>key</code>.
|
||||
* The {@code value} can be retrieved by calling the
|
||||
* {@code get} method with a {@code key} that is equal to
|
||||
* the original {@code key}.
|
||||
*
|
||||
* @param key the hashtable key.
|
||||
* @param value the value.
|
||||
* @return the previous value to which the <code>key</code> was mapped
|
||||
* in this dictionary, or <code>null</code> if the key did not
|
||||
* @return the previous value to which the {@code key} was mapped
|
||||
* in this dictionary, or {@code null} if the key did not
|
||||
* have a previous mapping.
|
||||
* @exception NullPointerException if the <code>key</code> or
|
||||
* <code>value</code> is <code>null</code>.
|
||||
* @exception NullPointerException if the {@code key} or
|
||||
* {@code value} is {@code null}.
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
* @see java.util.Dictionary#get(java.lang.Object)
|
||||
*/
|
||||
abstract public V put(K key, V value);
|
||||
|
||||
/**
|
||||
* Removes the <code>key</code> (and its corresponding
|
||||
* <code>value</code>) from this dictionary. This method does nothing
|
||||
* if the <code>key</code> is not in this dictionary.
|
||||
* Removes the {@code key} (and its corresponding
|
||||
* {@code value}) from this dictionary. This method does nothing
|
||||
* if the {@code key} is not in this dictionary.
|
||||
*
|
||||
* @param key the key that needs to be removed.
|
||||
* @return the value to which the <code>key</code> had been mapped in this
|
||||
* dictionary, or <code>null</code> if the key did not have a
|
||||
* @return the value to which the {@code key} had been mapped in this
|
||||
* dictionary, or {@code null} if the key did not have a
|
||||
* mapping.
|
||||
* @exception NullPointerException if <tt>key</tt> is <tt>null</tt>.
|
||||
* @exception NullPointerException if {@code key} is {@code null}.
|
||||
*/
|
||||
abstract public V remove(Object key);
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ package java.util;
|
||||
* Unchecked exception thrown when duplicate flags are provided in the format
|
||||
* specifier.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* Thrown by methods in the <code>Stack</code> class to indicate
|
||||
* Thrown by methods in the {@code Stack} class to indicate
|
||||
* that the stack is empty.
|
||||
*
|
||||
* @author Jonathan Payne
|
||||
@ -38,7 +38,7 @@ class EmptyStackException extends RuntimeException {
|
||||
private static final long serialVersionUID = 5084686378493302095L;
|
||||
|
||||
/**
|
||||
* Constructs a new <code>EmptyStackException</code> with <tt>null</tt>
|
||||
* Constructs a new {@code EmptyStackException} with {@code null}
|
||||
* as its error message string.
|
||||
*/
|
||||
public EmptyStackException() {
|
||||
|
||||
@ -50,7 +50,7 @@ import sun.misc.SharedSecrets;
|
||||
* presence of a null key or to remove one will, however, function properly.
|
||||
* Null values are permitted.
|
||||
|
||||
* <P>Like most collection implementations <tt>EnumMap</tt> is not
|
||||
* <P>Like most collection implementations {@code EnumMap} is not
|
||||
* synchronized. If multiple threads access an enum map concurrently, and at
|
||||
* least one of the threads modifies the map, it should be synchronized
|
||||
* externally. This is typically accomplished by synchronizing on some
|
||||
@ -80,7 +80,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
implements java.io.Serializable, Cloneable
|
||||
{
|
||||
/**
|
||||
* The <tt>Class</tt> object for the enum type of all the keys of this map.
|
||||
* The {@code Class} object for the enum type of all the keys of this map.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
@ -131,7 +131,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
* Creates an empty enum map with the specified key type.
|
||||
*
|
||||
* @param keyType the class object of the key type for this enum map
|
||||
* @throws NullPointerException if <tt>keyType</tt> is null
|
||||
* @throws NullPointerException if {@code keyType} is null
|
||||
*/
|
||||
public EnumMap(Class<K> keyType) {
|
||||
this.keyType = keyType;
|
||||
@ -144,7 +144,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
* map, initially containing the same mappings (if any).
|
||||
*
|
||||
* @param m the enum map from which to initialize this enum map
|
||||
* @throws NullPointerException if <tt>m</tt> is null
|
||||
* @throws NullPointerException if {@code m} is null
|
||||
*/
|
||||
public EnumMap(EnumMap<K, ? extends V> m) {
|
||||
keyType = m.keyType;
|
||||
@ -155,15 +155,15 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
|
||||
/**
|
||||
* Creates an enum map initialized from the specified map. If the
|
||||
* specified map is an <tt>EnumMap</tt> instance, this constructor behaves
|
||||
* specified map is an {@code EnumMap} instance, this constructor behaves
|
||||
* identically to {@link #EnumMap(EnumMap)}. Otherwise, the specified map
|
||||
* must contain at least one mapping (in order to determine the new
|
||||
* enum map's key type).
|
||||
*
|
||||
* @param m the map from which to initialize this enum map
|
||||
* @throws IllegalArgumentException if <tt>m</tt> is not an
|
||||
* <tt>EnumMap</tt> instance and contains no mappings
|
||||
* @throws NullPointerException if <tt>m</tt> is null
|
||||
* @throws IllegalArgumentException if {@code m} is not an
|
||||
* {@code EnumMap} instance and contains no mappings
|
||||
* @throws NullPointerException if {@code m} is null
|
||||
*/
|
||||
public EnumMap(Map<K, ? extends V> m) {
|
||||
if (m instanceof EnumMap) {
|
||||
@ -194,11 +194,11 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map maps one or more keys to the
|
||||
* Returns {@code true} if this map maps one or more keys to the
|
||||
* specified value.
|
||||
*
|
||||
* @param value the value whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map maps one or more keys to this value
|
||||
* @return {@code true} if this map maps one or more keys to this value
|
||||
*/
|
||||
public boolean containsValue(Object value) {
|
||||
value = maskNull(value);
|
||||
@ -211,11 +211,11 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map contains a mapping for the specified
|
||||
* Returns {@code true} if this map contains a mapping for the specified
|
||||
* key.
|
||||
*
|
||||
* @param key the key whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map contains a mapping for the specified
|
||||
* @return {@code true} if this map contains a mapping for the specified
|
||||
* key
|
||||
*/
|
||||
public boolean containsKey(Object key) {
|
||||
@ -258,9 +258,9 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
* @param value the value to be associated with the specified key
|
||||
*
|
||||
* @return the previous value associated with specified key, or
|
||||
* <tt>null</tt> if there was no mapping for key. (A <tt>null</tt>
|
||||
* {@code null} if there was no mapping for key. (A {@code null}
|
||||
* return can also indicate that the map previously associated
|
||||
* <tt>null</tt> with the specified key.)
|
||||
* {@code null} with the specified key.)
|
||||
* @throws NullPointerException if the specified key is null
|
||||
*/
|
||||
public V put(K key, V value) {
|
||||
@ -279,9 +279,9 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
*
|
||||
* @param key the key whose mapping is to be removed from the map
|
||||
* @return the previous value associated with specified key, or
|
||||
* <tt>null</tt> if there was no entry for key. (A <tt>null</tt>
|
||||
* {@code null} if there was no entry for key. (A {@code null}
|
||||
* return can also indicate that the map previously associated
|
||||
* <tt>null</tt> with the specified key.)
|
||||
* {@code null} with the specified key.)
|
||||
*/
|
||||
public V remove(Object key) {
|
||||
if (!isValidKey(key))
|
||||
@ -644,12 +644,12 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
|
||||
/**
|
||||
* Compares the specified object with this map for equality. Returns
|
||||
* <tt>true</tt> if the given object is also a map and the two maps
|
||||
* {@code true} if the given object is also a map and the two maps
|
||||
* represent the same mappings, as specified in the {@link
|
||||
* Map#equals(Object)} contract.
|
||||
*
|
||||
* @param o the object to be compared for equality with this map
|
||||
* @return <tt>true</tt> if the specified object is equal to this map
|
||||
* @return {@code true} if the specified object is equal to this map
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
@ -758,7 +758,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
private static final long serialVersionUID = 458661240069192865L;
|
||||
|
||||
/**
|
||||
* Save the state of the <tt>EnumMap</tt> instance to a stream (i.e.,
|
||||
* Save the state of the {@code EnumMap} instance to a stream (i.e.,
|
||||
* serialize it).
|
||||
*
|
||||
* @serialData The <i>size</i> of the enum map (the number of key-value
|
||||
@ -787,7 +787,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstitute the <tt>EnumMap</tt> instance from a stream (i.e.,
|
||||
* Reconstitute the {@code EnumMap} instance from a stream (i.e.,
|
||||
* deserialize it).
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@ -34,11 +34,11 @@ import sun.misc.SharedSecrets;
|
||||
* are represented internally as bit vectors. This representation is
|
||||
* extremely compact and efficient. The space and time performance of this
|
||||
* class should be good enough to allow its use as a high-quality, typesafe
|
||||
* alternative to traditional <tt>int</tt>-based "bit flags." Even bulk
|
||||
* operations (such as <tt>containsAll</tt> and <tt>retainAll</tt>) should
|
||||
* alternative to traditional {@code int}-based "bit flags." Even bulk
|
||||
* operations (such as {@code containsAll} and {@code retainAll}) should
|
||||
* run very quickly if their argument is also an enum set.
|
||||
*
|
||||
* <p>The iterator returned by the <tt>iterator</tt> method traverses the
|
||||
* <p>The iterator returned by the {@code iterator} method traverses the
|
||||
* elements in their <i>natural order</i> (the order in which the enum
|
||||
* constants are declared). The returned iterator is <i>weakly
|
||||
* consistent</i>: it will never throw {@link ConcurrentModificationException}
|
||||
@ -50,7 +50,7 @@ import sun.misc.SharedSecrets;
|
||||
* presence of a null element or to remove one will, however, function
|
||||
* properly.
|
||||
*
|
||||
* <P>Like most collection implementations, <tt>EnumSet</tt> is not
|
||||
* <P>Like most collection implementations, {@code EnumSet} is not
|
||||
* synchronized. If multiple threads access an enum set concurrently, and at
|
||||
* least one of the threads modifies the set, it should be synchronized
|
||||
* externally. This is typically accomplished by synchronizing on some
|
||||
@ -106,7 +106,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
* @param elementType the class object of the element type for this enum
|
||||
* set
|
||||
* @return An empty enum set of the specified type.
|
||||
* @throws NullPointerException if <tt>elementType</tt> is null
|
||||
* @throws NullPointerException if {@code elementType} is null
|
||||
*/
|
||||
public static <E extends Enum<E>> EnumSet<E> noneOf(Class<E> elementType) {
|
||||
Enum<?>[] universe = getUniverse(elementType);
|
||||
@ -127,7 +127,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
* @param elementType the class object of the element type for this enum
|
||||
* set
|
||||
* @return An enum set containing all the elements in the specified type.
|
||||
* @throws NullPointerException if <tt>elementType</tt> is null
|
||||
* @throws NullPointerException if {@code elementType} is null
|
||||
*/
|
||||
public static <E extends Enum<E>> EnumSet<E> allOf(Class<E> elementType) {
|
||||
EnumSet<E> result = noneOf(elementType);
|
||||
@ -148,7 +148,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
* @param <E> The class of the elements in the set
|
||||
* @param s the enum set from which to initialize this enum set
|
||||
* @return A copy of the specified enum set.
|
||||
* @throws NullPointerException if <tt>s</tt> is null
|
||||
* @throws NullPointerException if {@code s} is null
|
||||
*/
|
||||
public static <E extends Enum<E>> EnumSet<E> copyOf(EnumSet<E> s) {
|
||||
return s.clone();
|
||||
@ -156,7 +156,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
|
||||
/**
|
||||
* Creates an enum set initialized from the specified collection. If
|
||||
* the specified collection is an <tt>EnumSet</tt> instance, this static
|
||||
* the specified collection is an {@code EnumSet} instance, this static
|
||||
* factory method behaves identically to {@link #copyOf(EnumSet)}.
|
||||
* Otherwise, the specified collection must contain at least one element
|
||||
* (in order to determine the new enum set's element type).
|
||||
@ -164,9 +164,9 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
* @param <E> The class of the elements in the collection
|
||||
* @param c the collection from which to initialize this enum set
|
||||
* @return An enum set initialized from the given collection.
|
||||
* @throws IllegalArgumentException if <tt>c</tt> is not an
|
||||
* <tt>EnumSet</tt> instance and contains no elements
|
||||
* @throws NullPointerException if <tt>c</tt> is null
|
||||
* @throws IllegalArgumentException if {@code c} is not an
|
||||
* {@code EnumSet} instance and contains no elements
|
||||
* @throws NullPointerException if {@code c} is null
|
||||
*/
|
||||
public static <E extends Enum<E>> EnumSet<E> copyOf(Collection<E> c) {
|
||||
if (c instanceof EnumSet) {
|
||||
@ -191,7 +191,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
* @param <E> The class of the elements in the enum set
|
||||
* @param s the enum set from whose complement to initialize this enum set
|
||||
* @return The complement of the specified set in this set
|
||||
* @throws NullPointerException if <tt>s</tt> is null
|
||||
* @throws NullPointerException if {@code s} is null
|
||||
*/
|
||||
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s) {
|
||||
EnumSet<E> result = copyOf(s);
|
||||
@ -210,7 +210,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
*
|
||||
* @param <E> The class of the specified element and of the set
|
||||
* @param e the element that this set is to contain initially
|
||||
* @throws NullPointerException if <tt>e</tt> is null
|
||||
* @throws NullPointerException if {@code e} is null
|
||||
* @return an enum set initially containing the specified element
|
||||
*/
|
||||
public static <E extends Enum<E>> EnumSet<E> of(E e) {
|
||||
@ -332,7 +332,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
|
||||
* @param first an element that the set is to contain initially
|
||||
* @param rest the remaining elements the set is to contain initially
|
||||
* @throws NullPointerException if any of the specified elements are null,
|
||||
* or if <tt>rest</tt> is null
|
||||
* or if {@code rest} is null
|
||||
* @return an enum set initially containing the specified elements
|
||||
*/
|
||||
@SafeVarargs
|
||||
|
||||
@ -28,10 +28,10 @@ package java.util;
|
||||
/**
|
||||
* An object that implements the Enumeration interface generates a
|
||||
* series of elements, one at a time. Successive calls to the
|
||||
* <code>nextElement</code> method return successive elements of the
|
||||
* {@code nextElement} method return successive elements of the
|
||||
* series.
|
||||
* <p>
|
||||
* For example, to print all elements of a <tt>Vector<E></tt> <i>v</i>:
|
||||
* For example, to print all elements of a {@code Vector<E>} <i>v</i>:
|
||||
* <pre>
|
||||
* for (Enumeration<E> e = v.elements(); e.hasMoreElements();)
|
||||
* System.out.println(e.nextElement());</pre>
|
||||
@ -39,7 +39,7 @@ package java.util;
|
||||
* Methods are provided to enumerate through the elements of a
|
||||
* vector, the keys of a hashtable, and the values in a hashtable.
|
||||
* Enumerations are also used to specify the input streams to a
|
||||
* <code>SequenceInputStream</code>.
|
||||
* {@code SequenceInputStream}.
|
||||
*
|
||||
* @apiNote
|
||||
* The functionality of this interface is duplicated by the {@link Iterator}
|
||||
@ -65,9 +65,9 @@ public interface Enumeration<E> {
|
||||
/**
|
||||
* Tests if this enumeration contains more elements.
|
||||
*
|
||||
* @return <code>true</code> if and only if this enumeration object
|
||||
* @return {@code true} if and only if this enumeration object
|
||||
* contains at least one more element to provide;
|
||||
* <code>false</code> otherwise.
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
boolean hasMoreElements();
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ package java.util;
|
||||
/**
|
||||
* Unchecked exception thrown when a conversion and flag are incompatible.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -28,8 +28,8 @@ package java.util;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* The <tt>Formattable</tt> interface must be implemented by any class that
|
||||
* needs to perform custom formatting using the <tt>'s'</tt> conversion
|
||||
* The {@code Formattable} interface must be implemented by any class that
|
||||
* needs to perform custom formatting using the {@code 's'} conversion
|
||||
* specifier of {@link java.util.Formatter}. This interface allows basic
|
||||
* control for formatting arbitrary objects.
|
||||
*
|
||||
@ -110,7 +110,7 @@ import java.io.IOException;
|
||||
* safety is optional and may be enforced by classes that extend and implement
|
||||
* this interface.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to
|
||||
* any method in this interface will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
@ -126,7 +126,7 @@ public interface Formattable {
|
||||
* {@link Formatter#out() formatter.out()} or {@link
|
||||
* Formatter#locale() formatter.locale()} to obtain the {@link
|
||||
* Appendable} or {@link Locale} used by this
|
||||
* <tt>formatter</tt> respectively.
|
||||
* {@code formatter} respectively.
|
||||
*
|
||||
* @param flags
|
||||
* The flags modify the output format. The value is interpreted as
|
||||
@ -139,19 +139,19 @@ public interface Formattable {
|
||||
* @param width
|
||||
* The minimum number of characters to be written to the output.
|
||||
* If the length of the converted value is less than the
|
||||
* <tt>width</tt> then the output will be padded by
|
||||
* <tt>' '</tt> until the total number of characters
|
||||
* {@code width} then the output will be padded by
|
||||
* <code>' '</code> until the total number of characters
|
||||
* equals width. The padding is at the beginning by default. If
|
||||
* the {@link FormattableFlags#LEFT_JUSTIFY} flag is set then the
|
||||
* padding will be at the end. If <tt>width</tt> is <tt>-1</tt>
|
||||
* padding will be at the end. If {@code width} is {@code -1}
|
||||
* then there is no minimum.
|
||||
*
|
||||
* @param precision
|
||||
* The maximum number of characters to be written to the output.
|
||||
* The precision is applied before the width, thus the output will
|
||||
* be truncated to <tt>precision</tt> characters even if the
|
||||
* <tt>width</tt> is greater than the <tt>precision</tt>. If
|
||||
* <tt>precision</tt> is <tt>-1</tt> then there is no explicit
|
||||
* be truncated to {@code precision} characters even if the
|
||||
* {@code width} is greater than the {@code precision}. If
|
||||
* {@code precision} is {@code -1} then there is no explicit
|
||||
* limit on the number of characters.
|
||||
*
|
||||
* @throws IllegalFormatException
|
||||
|
||||
@ -39,12 +39,12 @@ public class FormattableFlags {
|
||||
private FormattableFlags() {}
|
||||
|
||||
/**
|
||||
* Left-justifies the output. Spaces (<tt>'\u0020'</tt>) will be added
|
||||
* Left-justifies the output. Spaces (<code>'\u0020'</code>) will be added
|
||||
* at the end of the converted value as required to fill the minimum width
|
||||
* of the field. If this flag is not set then the output will be
|
||||
* right-justified.
|
||||
*
|
||||
* <p> This flag corresponds to <tt>'-'</tt> (<tt>'\u002d'</tt>) in
|
||||
* <p> This flag corresponds to {@code '-'} (<code>'\u002d'</code>) in
|
||||
* the format specifier.
|
||||
*/
|
||||
public static final int LEFT_JUSTIFY = 1<<0; // '-'
|
||||
@ -52,23 +52,23 @@ public class FormattableFlags {
|
||||
/**
|
||||
* Converts the output to upper case according to the rules of the
|
||||
* {@linkplain java.util.Locale locale} given during creation of the
|
||||
* <tt>formatter</tt> argument of the {@link Formattable#formatTo
|
||||
* {@code formatter} argument of the {@link Formattable#formatTo
|
||||
* formatTo()} method. The output should be equivalent the following
|
||||
* invocation of {@link String#toUpperCase(java.util.Locale)}
|
||||
*
|
||||
* <pre>
|
||||
* out.toUpperCase() </pre>
|
||||
*
|
||||
* <p> This flag corresponds to <tt>'S'</tt> (<tt>'\u0053'</tt>) in
|
||||
* <p> This flag corresponds to {@code 'S'} (<code>'\u0053'</code>) in
|
||||
* the format specifier.
|
||||
*/
|
||||
public static final int UPPERCASE = 1<<1; // 'S'
|
||||
|
||||
/**
|
||||
* Requires the output to use an alternate form. The definition of the
|
||||
* form is specified by the <tt>Formattable</tt>.
|
||||
* form is specified by the {@code Formattable}.
|
||||
*
|
||||
* <p> This flag corresponds to <tt>'#'</tt> (<tt>'\u0023'</tt>) in
|
||||
* <p> This flag corresponds to {@code '#'} (<code>'\u0023'</code>) in
|
||||
* the format specifier.
|
||||
*/
|
||||
public static final int ALTERNATE = 1<<2; // '#'
|
||||
|
||||
@ -267,7 +267,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* {@link Date} and {@link TemporalAccessor TemporalAccessor}
|
||||
*
|
||||
* <li> <b>Percent</b> - produces a literal {@code '%'}
|
||||
* (<tt>'\u0025'</tt>)
|
||||
* (<code>'\u0025'</code>)
|
||||
*
|
||||
* <li> <b>Line Separator</b> - produces the platform-specific line separator
|
||||
*
|
||||
@ -356,7 +356,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
*
|
||||
* <tr><td valign="top">{@code '%'}
|
||||
* <td valign="top"> percent
|
||||
* <td> The result is a literal {@code '%'} (<tt>'\u0025'</tt>)
|
||||
* <td> The result is a literal {@code '%'} (<code>'\u0025'</code>)
|
||||
*
|
||||
* <tr><td valign="top">{@code 'n'}
|
||||
* <td valign="top"> line separator
|
||||
@ -644,7 +644,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* "{@code 1$}", the second by "{@code 2$}", etc.
|
||||
*
|
||||
* <p> Another way to reference arguments by position is to use the
|
||||
* {@code '<'} (<tt>'\u003c'</tt>) flag, which causes the argument for
|
||||
* {@code '<'} (<code>'\u003c'</code>) flag, which causes the argument for
|
||||
* the previous format specifier to be re-used. For example, the following two
|
||||
* statements would produce identical strings:
|
||||
*
|
||||
@ -701,7 +701,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="dgConv">
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'b'}
|
||||
* <td valign="top"> <tt>'\u0062'</tt>
|
||||
* <td valign="top"> <code>'\u0062'</code>
|
||||
* <td> Produces either "{@code true}" or "{@code false}" as returned by
|
||||
* {@link Boolean#toString(boolean)}.
|
||||
*
|
||||
@ -715,11 +715,11 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'B'}
|
||||
* <td valign="top"> <tt>'\u0042'</tt>
|
||||
* <td valign="top"> <code>'\u0042'</code>
|
||||
* <td> The upper-case variant of {@code 'b'}.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'h'}
|
||||
* <td valign="top"> <tt>'\u0068'</tt>
|
||||
* <td valign="top"> <code>'\u0068'</code>
|
||||
* <td> Produces a string representing the hash code value of the object.
|
||||
*
|
||||
* <p> If the argument, <i>arg</i> is {@code null}, then the
|
||||
@ -730,11 +730,11 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'H'}
|
||||
* <td valign="top"> <tt>'\u0048'</tt>
|
||||
* <td valign="top"> <code>'\u0048'</code>
|
||||
* <td> The upper-case variant of {@code 'h'}.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 's'}
|
||||
* <td valign="top"> <tt>'\u0073'</tt>
|
||||
* <td valign="top"> <code>'\u0073'</code>
|
||||
* <td> Produces a string.
|
||||
*
|
||||
* <p> If the argument is {@code null}, then the result is
|
||||
@ -748,7 +748,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'S'}
|
||||
* <td valign="top"> <tt>'\u0053'</tt>
|
||||
* <td valign="top"> <code>'\u0053'</code>
|
||||
* <td> The upper-case variant of {@code 's'}.
|
||||
*
|
||||
* </table>
|
||||
@ -758,15 +758,15 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="dFlags">
|
||||
*
|
||||
* <tr><td valign="top"> {@code '-'}
|
||||
* <td valign="top"> <tt>'\u002d'</tt>
|
||||
* <td> Left justifies the output. Spaces (<tt>'\u0020'</tt>) will be
|
||||
* <td valign="top"> <code>'\u002d'</code>
|
||||
* <td> Left justifies the output. Spaces (<code>'\u0020'</code>) will be
|
||||
* added at the end of the converted value as required to fill the minimum
|
||||
* width of the field. If the width is not provided, then a {@link
|
||||
* MissingFormatWidthException} will be thrown. If this flag is not given
|
||||
* then the output will be right-justified.
|
||||
*
|
||||
* <tr><td valign="top"> {@code '#'}
|
||||
* <td valign="top"> <tt>'\u0023'</tt>
|
||||
* <td valign="top"> <code>'\u0023'</code>
|
||||
* <td> Requires the output use an alternate form. The definition of the
|
||||
* form is specified by the conversion.
|
||||
*
|
||||
@ -775,7 +775,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <p> The <a name="genWidth">width</a> is the minimum number of characters to
|
||||
* be written to the
|
||||
* output. If the length of the converted value is less than the width then
|
||||
* the output will be padded by <tt>' '</tt> (<tt>'\u0020'</tt>)
|
||||
* the output will be padded by <code>' '</code> (<code>'\u0020'</code>)
|
||||
* until the total number of characters equals the width. The padding is on
|
||||
* the left by default. If the {@code '-'} flag is given, then the padding
|
||||
* will be on the right. If the width is not specified then there is no
|
||||
@ -799,7 +799,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="charConv">
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'c'}
|
||||
* <td valign="top"> <tt>'\u0063'</tt>
|
||||
* <td valign="top"> <code>'\u0063'</code>
|
||||
* <td> Formats the argument as a Unicode character as described in <a
|
||||
* href="../lang/Character.html#unicode">Unicode Character
|
||||
* Representation</a>. This may be more than one 16-bit {@code char} in
|
||||
@ -809,7 +809,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'C'}
|
||||
* <td valign="top"> <tt>'\u0043'</tt>
|
||||
* <td valign="top"> <code>'\u0043'</code>
|
||||
* <td> The upper-case variant of {@code 'c'}.
|
||||
*
|
||||
* </table>
|
||||
@ -859,7 +859,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* java.text.DecimalFormatSymbols#getDecimalSeparator decimal separator} is
|
||||
* substituted.
|
||||
*
|
||||
* <li> If the {@code ','} (<tt>'\u002c'</tt>)
|
||||
* <li> If the {@code ','} (<code>'\u002c'</code>)
|
||||
* <a name="L10nGroup">flag</a> is given, then the locale-specific {@linkplain
|
||||
* java.text.DecimalFormatSymbols#getGroupingSeparator grouping separator} is
|
||||
* inserted by scanning the integer part of the string from least significant
|
||||
@ -873,15 +873,15 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* the length of the string is equal to the requested field width.
|
||||
*
|
||||
* <li> If the value is negative and the {@code '('} flag is given, then a
|
||||
* {@code '('} (<tt>'\u0028'</tt>) is prepended and a {@code ')'}
|
||||
* (<tt>'\u0029'</tt>) is appended.
|
||||
* {@code '('} (<code>'\u0028'</code>) is prepended and a {@code ')'}
|
||||
* (<code>'\u0029'</code>) is appended.
|
||||
*
|
||||
* <li> If the value is negative (or floating-point negative zero) and
|
||||
* {@code '('} flag is not given, then a {@code '-'} (<tt>'\u002d'</tt>)
|
||||
* {@code '('} flag is not given, then a {@code '-'} (<code>'\u002d'</code>)
|
||||
* is prepended.
|
||||
*
|
||||
* <li> If the {@code '+'} flag is given and the value is positive or zero (or
|
||||
* floating-point positive zero), then a {@code '+'} (<tt>'\u002b'</tt>)
|
||||
* floating-point positive zero), then a {@code '+'} (<code>'\u002b'</code>)
|
||||
* will be prepended.
|
||||
*
|
||||
* </ol>
|
||||
@ -900,7 +900,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="IntConv">
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'd'}
|
||||
* <td valign="top"> <tt>'\u0064'</tt>
|
||||
* <td valign="top"> <code>'\u0064'</code>
|
||||
* <td> Formats the argument as a decimal integer. The <a
|
||||
* href="#L10nAlgorithm">localization algorithm</a> is applied.
|
||||
*
|
||||
@ -911,7 +911,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'o'}
|
||||
* <td valign="top"> <tt>'\u006f'</tt>
|
||||
* <td valign="top"> <code>'\u006f'</code>
|
||||
* <td> Formats the argument as an integer in base eight. No localization
|
||||
* is applied.
|
||||
*
|
||||
@ -933,7 +933,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'x'}
|
||||
* <td valign="top"> <tt>'\u0078'</tt>
|
||||
* <td valign="top"> <code>'\u0078'</code>
|
||||
* <td> Formats the argument as an integer in base sixteen. No
|
||||
* localization is applied.
|
||||
*
|
||||
@ -951,17 +951,17 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* the field width with leading zeros after the radix indicator or sign (if
|
||||
* present).
|
||||
*
|
||||
* <p> If {@code '('}, <tt>' '</tt>, {@code '+'}, or
|
||||
* <p> If {@code '('}, <code>' '</code>, {@code '+'}, or
|
||||
* {@code ','} flags are given then a {@link
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'X'}
|
||||
* <td valign="top"> <tt>'\u0058'</tt>
|
||||
* <td valign="top"> <code>'\u0058'</code>
|
||||
* <td> The upper-case variant of {@code 'x'}. The entire string
|
||||
* representing the number will be converted to {@linkplain
|
||||
* String#toUpperCase upper case} including the {@code 'x'} (if any) and
|
||||
* all hexadecimal digits {@code 'a'} - {@code 'f'}
|
||||
* (<tt>'\u0061'</tt> - <tt>'\u0066'</tt>).
|
||||
* (<code>'\u0061'</code> - <code>'\u0066'</code>).
|
||||
*
|
||||
* </table>
|
||||
*
|
||||
@ -980,24 +980,24 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="intFlags">
|
||||
*
|
||||
* <tr><td valign="top"> {@code '+'}
|
||||
* <td valign="top"> <tt>'\u002b'</tt>
|
||||
* <td valign="top"> <code>'\u002b'</code>
|
||||
* <td> Requires the output to include a positive sign for all positive
|
||||
* numbers. If this flag is not given then only negative values will
|
||||
* include a sign.
|
||||
*
|
||||
* <p> If both the {@code '+'} and <tt>' '</tt> flags are given
|
||||
* <p> If both the {@code '+'} and <code>' '</code> flags are given
|
||||
* then an {@link IllegalFormatFlagsException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> <tt>' '</tt>
|
||||
* <td valign="top"> <tt>'\u0020'</tt>
|
||||
* <tr><td valign="top"> <code>' '</code>
|
||||
* <td valign="top"> <code>'\u0020'</code>
|
||||
* <td> Requires the output to include a single extra space
|
||||
* (<tt>'\u0020'</tt>) for non-negative values.
|
||||
* (<code>'\u0020'</code>) for non-negative values.
|
||||
*
|
||||
* <p> If both the {@code '+'} and <tt>' '</tt> flags are given
|
||||
* <p> If both the {@code '+'} and <code>' '</code> flags are given
|
||||
* then an {@link IllegalFormatFlagsException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code '0'}
|
||||
* <td valign="top"> <tt>'\u0030'</tt>
|
||||
* <td valign="top"> <code>'\u0030'</code>
|
||||
* <td> Requires the output to be padded with leading {@linkplain
|
||||
* java.text.DecimalFormatSymbols#getZeroDigit zeros} to the minimum field
|
||||
* width following any sign or radix indicator except when converting NaN
|
||||
@ -1008,17 +1008,17 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* {@link IllegalFormatFlagsException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code ','}
|
||||
* <td valign="top"> <tt>'\u002c'</tt>
|
||||
* <td valign="top"> <code>'\u002c'</code>
|
||||
* <td> Requires the output to include the locale-specific {@linkplain
|
||||
* java.text.DecimalFormatSymbols#getGroupingSeparator group separators} as
|
||||
* described in the <a href="#L10nGroup">"group" section</a> of the
|
||||
* localization algorithm.
|
||||
*
|
||||
* <tr><td valign="top"> {@code '('}
|
||||
* <td valign="top"> <tt>'\u0028'</tt>
|
||||
* <td valign="top"> <code>'\u0028'</code>
|
||||
* <td> Requires the output to prepend a {@code '('}
|
||||
* (<tt>'\u0028'</tt>) and append a {@code ')'}
|
||||
* (<tt>'\u0029'</tt>) to negative values.
|
||||
* (<code>'\u0028'</code>) and append a {@code ')'}
|
||||
* (<code>'\u0029'</code>) to negative values.
|
||||
*
|
||||
* </table>
|
||||
*
|
||||
@ -1029,7 +1029,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
*
|
||||
* <li> The output is right-justified within the {@code width}
|
||||
*
|
||||
* <li> Negative numbers begin with a {@code '-'} (<tt>'\u002d'</tt>)
|
||||
* <li> Negative numbers begin with a {@code '-'} (<code>'\u002d'</code>)
|
||||
*
|
||||
* <li> Positive numbers and zero do not include a sign or extra leading
|
||||
* space
|
||||
@ -1042,7 +1042,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* be written to the output. This includes any signs, digits, grouping
|
||||
* separators, radix indicator, and parentheses. If the length of the
|
||||
* converted value is less than the width then the output will be padded by
|
||||
* spaces (<tt>'\u0020'</tt>) until the total number of characters equals
|
||||
* spaces (<code>'\u0020'</code>) until the total number of characters equals
|
||||
* width. The padding is on the left by default. If {@code '-'} flag is
|
||||
* given then the padding will be on the right. If width is not specified then
|
||||
* there is no minimum.
|
||||
@ -1058,7 +1058,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="BIntConv">
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'd'}
|
||||
* <td valign="top"> <tt>'\u0064'</tt>
|
||||
* <td valign="top"> <code>'\u0064'</code>
|
||||
* <td> Requires the output to be formatted as a decimal integer. The <a
|
||||
* href="#L10nAlgorithm">localization algorithm</a> is applied.
|
||||
*
|
||||
@ -1066,18 +1066,18 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'o'}
|
||||
* <td valign="top"> <tt>'\u006f'</tt>
|
||||
* <td valign="top"> <code>'\u006f'</code>
|
||||
* <td> Requires the output to be formatted as an integer in base eight.
|
||||
* No localization is applied.
|
||||
*
|
||||
* <p> If <i>x</i> is negative then the result will be a signed value
|
||||
* beginning with {@code '-'} (<tt>'\u002d'</tt>). Signed output is
|
||||
* beginning with {@code '-'} (<code>'\u002d'</code>). Signed output is
|
||||
* allowed for this type because unlike the primitive types it is not
|
||||
* possible to create an unsigned equivalent without assuming an explicit
|
||||
* data-type size.
|
||||
*
|
||||
* <p> If <i>x</i> is positive or zero and the {@code '+'} flag is given
|
||||
* then the result will begin with {@code '+'} (<tt>'\u002b'</tt>).
|
||||
* then the result will begin with {@code '+'} (<code>'\u002b'</code>).
|
||||
*
|
||||
* <p> If the {@code '#'} flag is given then the output will always begin
|
||||
* with {@code '0'} prefix.
|
||||
@ -1089,18 +1089,18 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'x'}
|
||||
* <td valign="top"> <tt>'\u0078'</tt>
|
||||
* <td valign="top"> <code>'\u0078'</code>
|
||||
* <td> Requires the output to be formatted as an integer in base
|
||||
* sixteen. No localization is applied.
|
||||
*
|
||||
* <p> If <i>x</i> is negative then the result will be a signed value
|
||||
* beginning with {@code '-'} (<tt>'\u002d'</tt>). Signed output is
|
||||
* beginning with {@code '-'} (<code>'\u002d'</code>). Signed output is
|
||||
* allowed for this type because unlike the primitive types it is not
|
||||
* possible to create an unsigned equivalent without assuming an explicit
|
||||
* data-type size.
|
||||
*
|
||||
* <p> If <i>x</i> is positive or zero and the {@code '+'} flag is given
|
||||
* then the result will begin with {@code '+'} (<tt>'\u002b'</tt>).
|
||||
* then the result will begin with {@code '+'} (<code>'\u002b'</code>).
|
||||
*
|
||||
* <p> If the {@code '#'} flag is given then the output will always begin
|
||||
* with the radix indicator {@code "0x"}.
|
||||
@ -1113,12 +1113,12 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'X'}
|
||||
* <td valign="top"> <tt>'\u0058'</tt>
|
||||
* <td valign="top"> <code>'\u0058'</code>
|
||||
* <td> The upper-case variant of {@code 'x'}. The entire string
|
||||
* representing the number will be converted to {@linkplain
|
||||
* String#toUpperCase upper case} including the {@code 'x'} (if any) and
|
||||
* all hexadecimal digits {@code 'a'} - {@code 'f'}
|
||||
* (<tt>'\u0061'</tt> - <tt>'\u0066'</tt>).
|
||||
* (<code>'\u0061'</code> - <code>'\u0066'</code>).
|
||||
*
|
||||
* </table>
|
||||
*
|
||||
@ -1152,7 +1152,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="floatConv">
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'e'}
|
||||
* <td valign="top"> <tt>'\u0065'</tt>
|
||||
* <td valign="top"> <code>'\u0065'</code>
|
||||
* <td> Requires the output to be formatted using <a
|
||||
* name="scientific">computerized scientific notation</a>. The <a
|
||||
* href="#L10nAlgorithm">localization algorithm</a> is applied.
|
||||
@ -1179,7 +1179,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* integer part of <i>a</i>, as a single decimal digit, followed by the
|
||||
* decimal separator followed by decimal digits representing the fractional
|
||||
* part of <i>a</i>, followed by the exponent symbol {@code 'e'}
|
||||
* (<tt>'\u0065'</tt>), followed by the sign of the exponent, followed
|
||||
* (<code>'\u0065'</code>), followed by the sign of the exponent, followed
|
||||
* by a representation of <i>n</i> as a decimal integer, as produced by the
|
||||
* method {@link Long#toString(long, int)}, and zero-padded to include at
|
||||
* least two digits.
|
||||
@ -1200,12 +1200,12 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'E'}
|
||||
* <td valign="top"> <tt>'\u0045'</tt>
|
||||
* <td valign="top"> <code>'\u0045'</code>
|
||||
* <td> The upper-case variant of {@code 'e'}. The exponent symbol
|
||||
* will be {@code 'E'} (<tt>'\u0045'</tt>).
|
||||
* will be {@code 'E'} (<code>'\u0045'</code>).
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'g'}
|
||||
* <td valign="top"> <tt>'\u0067'</tt>
|
||||
* <td valign="top"> <code>'\u0067'</code>
|
||||
* <td> Requires the output to be formatted in general scientific notation
|
||||
* as described below. The <a href="#L10nAlgorithm">localization
|
||||
* algorithm</a> is applied.
|
||||
@ -1230,11 +1230,11 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'G'}
|
||||
* <td valign="top"> <tt>'\u0047'</tt>
|
||||
* <td valign="top"> <code>'\u0047'</code>
|
||||
* <td> The upper-case variant of {@code 'g'}.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'f'}
|
||||
* <td valign="top"> <tt>'\u0066'</tt>
|
||||
* <td valign="top"> <code>'\u0066'</code>
|
||||
* <td> Requires the output to be formatted using <a name="decimal">decimal
|
||||
* format</a>. The <a href="#L10nAlgorithm">localization algorithm</a> is
|
||||
* applied.
|
||||
@ -1266,7 +1266,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* appropriate.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'a'}
|
||||
* <td valign="top"> <tt>'\u0061'</tt>
|
||||
* <td valign="top"> <code>'\u0061'</code>
|
||||
* <td> Requires the output to be formatted in hexadecimal exponential
|
||||
* form. No localization is applied.
|
||||
*
|
||||
@ -1274,11 +1274,11 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* (absolute value) of the argument <i>x</i>.
|
||||
*
|
||||
* <p> If <i>x</i> is negative or a negative-zero value then the result
|
||||
* will begin with {@code '-'} (<tt>'\u002d'</tt>).
|
||||
* will begin with {@code '-'} (<code>'\u002d'</code>).
|
||||
*
|
||||
* <p> If <i>x</i> is positive or a positive-zero value and the
|
||||
* {@code '+'} flag is given then the result will begin with {@code '+'}
|
||||
* (<tt>'\u002b'</tt>).
|
||||
* (<code>'\u002b'</code>).
|
||||
*
|
||||
* <p> The formatting of the magnitude <i>m</i> depends upon its value.
|
||||
*
|
||||
@ -1295,7 +1295,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* exponent fields. The significand is represented by the characters
|
||||
* {@code "0x1."} followed by the hexadecimal representation of the rest
|
||||
* of the significand as a fraction. The exponent is represented by
|
||||
* {@code 'p'} (<tt>'\u0070'</tt>) followed by a decimal string of the
|
||||
* {@code 'p'} (<code>'\u0070'</code>) followed by a decimal string of the
|
||||
* unbiased exponent as if produced by invoking {@link
|
||||
* Integer#toString(int) Integer.toString} on the exponent value. If the
|
||||
* precision is specified, the value is rounded to the given number of
|
||||
@ -1319,12 +1319,12 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'A'}
|
||||
* <td valign="top"> <tt>'\u0041'</tt>
|
||||
* <td valign="top"> <code>'\u0041'</code>
|
||||
* <td> The upper-case variant of {@code 'a'}. The entire string
|
||||
* representing the number will be converted to upper case including the
|
||||
* {@code 'x'} (<tt>'\u0078'</tt>) and {@code 'p'}
|
||||
* (<tt>'\u0070'</tt> and all hexadecimal digits {@code 'a'} -
|
||||
* {@code 'f'} (<tt>'\u0061'</tt> - <tt>'\u0066'</tt>).
|
||||
* {@code 'x'} (<code>'\u0078'</code>) and {@code 'p'}
|
||||
* (<code>'\u0070'</code> and all hexadecimal digits {@code 'a'} -
|
||||
* {@code 'f'} (<code>'\u0061'</code> - <code>'\u0066'</code>).
|
||||
*
|
||||
* </table>
|
||||
*
|
||||
@ -1357,7 +1357,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* separators, decimal separators, exponential symbol, radix indicator,
|
||||
* parentheses, and strings representing infinity and NaN as applicable. If
|
||||
* the length of the converted value is less than the width then the output
|
||||
* will be padded by spaces (<tt>'\u0020'</tt>) until the total number of
|
||||
* will be padded by spaces (<code>'\u0020'</code>) until the total number of
|
||||
* characters equals width. The padding is on the left by default. If the
|
||||
* {@code '-'} flag is given then the padding will be on the right. If width
|
||||
* is not specified then there is no minimum.
|
||||
@ -1386,7 +1386,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="floatConv">
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'e'}
|
||||
* <td valign="top"> <tt>'\u0065'</tt>
|
||||
* <td valign="top"> <code>'\u0065'</code>
|
||||
* <td> Requires the output to be formatted using <a
|
||||
* name="bscientific">computerized scientific notation</a>. The <a
|
||||
* href="#L10nAlgorithm">localization algorithm</a> is applied.
|
||||
@ -1409,7 +1409,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* integer part of <i>a</i>, as a single decimal digit, followed by the
|
||||
* decimal separator followed by decimal digits representing the fractional
|
||||
* part of <i>a</i>, followed by the exponent symbol {@code 'e'}
|
||||
* (<tt>'\u0065'</tt>), followed by the sign of the exponent, followed
|
||||
* (<code>'\u0065'</code>), followed by the sign of the exponent, followed
|
||||
* by a representation of <i>n</i> as a decimal integer, as produced by the
|
||||
* method {@link Long#toString(long, int)}, and zero-padded to include at
|
||||
* least two digits.
|
||||
@ -1428,12 +1428,12 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'E'}
|
||||
* <td valign="top"> <tt>'\u0045'</tt>
|
||||
* <td valign="top"> <code>'\u0045'</code>
|
||||
* <td> The upper-case variant of {@code 'e'}. The exponent symbol
|
||||
* will be {@code 'E'} (<tt>'\u0045'</tt>).
|
||||
* will be {@code 'E'} (<code>'\u0045'</code>).
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'g'}
|
||||
* <td valign="top"> <tt>'\u0067'</tt>
|
||||
* <td valign="top"> <code>'\u0067'</code>
|
||||
* <td> Requires the output to be formatted in general scientific notation
|
||||
* as described below. The <a href="#L10nAlgorithm">localization
|
||||
* algorithm</a> is applied.
|
||||
@ -1458,11 +1458,11 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* FormatFlagsConversionMismatchException} will be thrown.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'G'}
|
||||
* <td valign="top"> <tt>'\u0047'</tt>
|
||||
* <td valign="top"> <code>'\u0047'</code>
|
||||
* <td> The upper-case variant of {@code 'g'}.
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'f'}
|
||||
* <td valign="top"> <tt>'\u0066'</tt>
|
||||
* <td valign="top"> <code>'\u0066'</code>
|
||||
* <td> Requires the output to be formatted using <a name="bdecimal">decimal
|
||||
* format</a>. The <a href="#L10nAlgorithm">localization algorithm</a> is
|
||||
* applied.
|
||||
@ -1510,10 +1510,10 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="DTConv">
|
||||
*
|
||||
* <tr><td valign="top"> {@code 't'}
|
||||
* <td valign="top"> <tt>'\u0074'</tt>
|
||||
* <td valign="top"> <code>'\u0074'</code>
|
||||
* <td> Prefix for date and time conversion characters.
|
||||
* <tr><td valign="top"> {@code 'T'}
|
||||
* <td valign="top"> <tt>'\u0054'</tt>
|
||||
* <td valign="top"> <code>'\u0054'</code>
|
||||
* <td> The upper-case variant of {@code 't'}.
|
||||
*
|
||||
* </table>
|
||||
@ -1530,52 +1530,52 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="time">
|
||||
*
|
||||
* <tr><td valign="top"> {@code 'H'}
|
||||
* <td valign="top"> <tt>'\u0048'</tt>
|
||||
* <td valign="top"> <code>'\u0048'</code>
|
||||
* <td> Hour of the day for the 24-hour clock, formatted as two digits with
|
||||
* a leading zero as necessary i.e. {@code 00 - 23}. {@code 00}
|
||||
* corresponds to midnight.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'I'}
|
||||
* <td valign="top"> <tt>'\u0049'</tt>
|
||||
* <td valign="top"> <code>'\u0049'</code>
|
||||
* <td> Hour for the 12-hour clock, formatted as two digits with a leading
|
||||
* zero as necessary, i.e. {@code 01 - 12}. {@code 01} corresponds to
|
||||
* one o'clock (either morning or afternoon).
|
||||
*
|
||||
* <tr><td valign="top">{@code 'k'}
|
||||
* <td valign="top"> <tt>'\u006b'</tt>
|
||||
* <td valign="top"> <code>'\u006b'</code>
|
||||
* <td> Hour of the day for the 24-hour clock, i.e. {@code 0 - 23}.
|
||||
* {@code 0} corresponds to midnight.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'l'}
|
||||
* <td valign="top"> <tt>'\u006c'</tt>
|
||||
* <td valign="top"> <code>'\u006c'</code>
|
||||
* <td> Hour for the 12-hour clock, i.e. {@code 1 - 12}. {@code 1}
|
||||
* corresponds to one o'clock (either morning or afternoon).
|
||||
*
|
||||
* <tr><td valign="top">{@code 'M'}
|
||||
* <td valign="top"> <tt>'\u004d'</tt>
|
||||
* <td valign="top"> <code>'\u004d'</code>
|
||||
* <td> Minute within the hour formatted as two digits with a leading zero
|
||||
* as necessary, i.e. {@code 00 - 59}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'S'}
|
||||
* <td valign="top"> <tt>'\u0053'</tt>
|
||||
* <td valign="top"> <code>'\u0053'</code>
|
||||
* <td> Seconds within the minute, formatted as two digits with a leading
|
||||
* zero as necessary, i.e. {@code 00 - 60} ("{@code 60}" is a special
|
||||
* value required to support leap seconds).
|
||||
*
|
||||
* <tr><td valign="top">{@code 'L'}
|
||||
* <td valign="top"> <tt>'\u004c'</tt>
|
||||
* <td valign="top"> <code>'\u004c'</code>
|
||||
* <td> Millisecond within the second formatted as three digits with
|
||||
* leading zeros as necessary, i.e. {@code 000 - 999}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'N'}
|
||||
* <td valign="top"> <tt>'\u004e'</tt>
|
||||
* <td valign="top"> <code>'\u004e'</code>
|
||||
* <td> Nanosecond within the second, formatted as nine digits with leading
|
||||
* zeros as necessary, i.e. {@code 000000000 - 999999999}. The precision
|
||||
* of this value is limited by the resolution of the underlying operating
|
||||
* system or hardware.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'p'}
|
||||
* <td valign="top"> <tt>'\u0070'</tt>
|
||||
* <td valign="top"> <code>'\u0070'</code>
|
||||
* <td> Locale-specific {@linkplain
|
||||
* java.text.DateFormatSymbols#getAmPmStrings morning or afternoon} marker
|
||||
* in lower case, e.g."{@code am}" or "{@code pm}". Use of the
|
||||
@ -1585,7 +1585,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* upper-case output.)
|
||||
*
|
||||
* <tr><td valign="top">{@code 'z'}
|
||||
* <td valign="top"> <tt>'\u007a'</tt>
|
||||
* <td valign="top"> <code>'\u007a'</code>
|
||||
* <td> <a href="http://www.ietf.org/rfc/rfc0822.txt">RFC 822</a>
|
||||
* style numeric time zone offset from GMT, e.g. {@code -0800}. This
|
||||
* value will be adjusted as necessary for Daylight Saving Time. For
|
||||
@ -1594,7 +1594,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* instance of the Java virtual machine.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'Z'}
|
||||
* <td valign="top"> <tt>'\u005a'</tt>
|
||||
* <td valign="top"> <code>'\u005a'</code>
|
||||
* <td> A string representing the abbreviation for the time zone. This
|
||||
* value will be adjusted as necessary for Daylight Saving Time. For
|
||||
* {@code long}, {@link Long}, and {@link Date} the time zone used is
|
||||
@ -1603,13 +1603,13 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* supersede the locale of the argument (if any).
|
||||
*
|
||||
* <tr><td valign="top">{@code 's'}
|
||||
* <td valign="top"> <tt>'\u0073'</tt>
|
||||
* <td valign="top"> <code>'\u0073'</code>
|
||||
* <td> Seconds since the beginning of the epoch starting at 1 January 1970
|
||||
* {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE/1000} to
|
||||
* {@code Long.MAX_VALUE/1000}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'Q'}
|
||||
* <td valign="top"> <tt>'\u004f'</tt>
|
||||
* <td valign="top"> <code>'\u004f'</code>
|
||||
* <td> Milliseconds since the beginning of the epoch starting at 1 January
|
||||
* 1970 {@code 00:00:00} UTC, i.e. {@code Long.MIN_VALUE} to
|
||||
* {@code Long.MAX_VALUE}. The precision of this value is limited by
|
||||
@ -1622,68 +1622,68 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="date">
|
||||
*
|
||||
* <tr><td valign="top">{@code 'B'}
|
||||
* <td valign="top"> <tt>'\u0042'</tt>
|
||||
* <td valign="top"> <code>'\u0042'</code>
|
||||
* <td> Locale-specific {@linkplain java.text.DateFormatSymbols#getMonths
|
||||
* full month name}, e.g. {@code "January"}, {@code "February"}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'b'}
|
||||
* <td valign="top"> <tt>'\u0062'</tt>
|
||||
* <td valign="top"> <code>'\u0062'</code>
|
||||
* <td> Locale-specific {@linkplain
|
||||
* java.text.DateFormatSymbols#getShortMonths abbreviated month name},
|
||||
* e.g. {@code "Jan"}, {@code "Feb"}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'h'}
|
||||
* <td valign="top"> <tt>'\u0068'</tt>
|
||||
* <td valign="top"> <code>'\u0068'</code>
|
||||
* <td> Same as {@code 'b'}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'A'}
|
||||
* <td valign="top"> <tt>'\u0041'</tt>
|
||||
* <td valign="top"> <code>'\u0041'</code>
|
||||
* <td> Locale-specific full name of the {@linkplain
|
||||
* java.text.DateFormatSymbols#getWeekdays day of the week},
|
||||
* e.g. {@code "Sunday"}, {@code "Monday"}
|
||||
*
|
||||
* <tr><td valign="top">{@code 'a'}
|
||||
* <td valign="top"> <tt>'\u0061'</tt>
|
||||
* <td valign="top"> <code>'\u0061'</code>
|
||||
* <td> Locale-specific short name of the {@linkplain
|
||||
* java.text.DateFormatSymbols#getShortWeekdays day of the week},
|
||||
* e.g. {@code "Sun"}, {@code "Mon"}
|
||||
*
|
||||
* <tr><td valign="top">{@code 'C'}
|
||||
* <td valign="top"> <tt>'\u0043'</tt>
|
||||
* <td valign="top"> <code>'\u0043'</code>
|
||||
* <td> Four-digit year divided by {@code 100}, formatted as two digits
|
||||
* with leading zero as necessary, i.e. {@code 00 - 99}
|
||||
*
|
||||
* <tr><td valign="top">{@code 'Y'}
|
||||
* <td valign="top"> <tt>'\u0059'</tt> <td> Year, formatted to at least
|
||||
* <td valign="top"> <code>'\u0059'</code> <td> Year, formatted to at least
|
||||
* four digits with leading zeros as necessary, e.g. {@code 0092} equals
|
||||
* {@code 92} CE for the Gregorian calendar.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'y'}
|
||||
* <td valign="top"> <tt>'\u0079'</tt>
|
||||
* <td valign="top"> <code>'\u0079'</code>
|
||||
* <td> Last two digits of the year, formatted with leading zeros as
|
||||
* necessary, i.e. {@code 00 - 99}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'j'}
|
||||
* <td valign="top"> <tt>'\u006a'</tt>
|
||||
* <td valign="top"> <code>'\u006a'</code>
|
||||
* <td> Day of year, formatted as three digits with leading zeros as
|
||||
* necessary, e.g. {@code 001 - 366} for the Gregorian calendar.
|
||||
* {@code 001} corresponds to the first day of the year.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'm'}
|
||||
* <td valign="top"> <tt>'\u006d'</tt>
|
||||
* <td valign="top"> <code>'\u006d'</code>
|
||||
* <td> Month, formatted as two digits with leading zeros as necessary,
|
||||
* i.e. {@code 01 - 13}, where "{@code 01}" is the first month of the
|
||||
* year and ("{@code 13}" is a special value required to support lunar
|
||||
* calendars).
|
||||
*
|
||||
* <tr><td valign="top">{@code 'd'}
|
||||
* <td valign="top"> <tt>'\u0064'</tt>
|
||||
* <td valign="top"> <code>'\u0064'</code>
|
||||
* <td> Day of month, formatted as two digits with leading zeros as
|
||||
* necessary, i.e. {@code 01 - 31}, where "{@code 01}" is the first day
|
||||
* of the month.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'e'}
|
||||
* <td valign="top"> <tt>'\u0065'</tt>
|
||||
* <td valign="top"> <code>'\u0065'</code>
|
||||
* <td> Day of month, formatted as two digits, i.e. {@code 1 - 31} where
|
||||
* "{@code 1}" is the first day of the month.
|
||||
*
|
||||
@ -1695,30 +1695,30 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="composites">
|
||||
*
|
||||
* <tr><td valign="top">{@code 'R'}
|
||||
* <td valign="top"> <tt>'\u0052'</tt>
|
||||
* <td valign="top"> <code>'\u0052'</code>
|
||||
* <td> Time formatted for the 24-hour clock as {@code "%tH:%tM"}
|
||||
*
|
||||
* <tr><td valign="top">{@code 'T'}
|
||||
* <td valign="top"> <tt>'\u0054'</tt>
|
||||
* <td valign="top"> <code>'\u0054'</code>
|
||||
* <td> Time formatted for the 24-hour clock as {@code "%tH:%tM:%tS"}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'r'}
|
||||
* <td valign="top"> <tt>'\u0072'</tt>
|
||||
* <td valign="top"> <code>'\u0072'</code>
|
||||
* <td> Time formatted for the 12-hour clock as {@code "%tI:%tM:%tS
|
||||
* %Tp"}. The location of the morning or afternoon marker
|
||||
* ({@code '%Tp'}) may be locale-dependent.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'D'}
|
||||
* <td valign="top"> <tt>'\u0044'</tt>
|
||||
* <td valign="top"> <code>'\u0044'</code>
|
||||
* <td> Date formatted as {@code "%tm/%td/%ty"}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'F'}
|
||||
* <td valign="top"> <tt>'\u0046'</tt>
|
||||
* <td valign="top"> <code>'\u0046'</code>
|
||||
* <td> <a href="http://www.w3.org/TR/NOTE-datetime">ISO 8601</a>
|
||||
* complete date formatted as {@code "%tY-%tm-%td"}.
|
||||
*
|
||||
* <tr><td valign="top">{@code 'c'}
|
||||
* <td valign="top"> <tt>'\u0063'</tt>
|
||||
* <td valign="top"> <code>'\u0063'</code>
|
||||
* <td> Date and time formatted as {@code "%ta %tb %td %tT %tZ %tY"},
|
||||
* e.g. {@code "Sun Jul 20 16:17:00 EDT 1969"}.
|
||||
*
|
||||
@ -1731,7 +1731,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <p> The width is the minimum number of characters to
|
||||
* be written to the output. If the length of the converted value is less than
|
||||
* the {@code width} then the output will be padded by spaces
|
||||
* (<tt>'\u0020'</tt>) until the total number of characters equals width.
|
||||
* (<code>'\u0020'</code>) until the total number of characters equals width.
|
||||
* The padding is on the left by default. If the {@code '-'} flag is given
|
||||
* then the padding will be on the right. If width is not specified then there
|
||||
* is no minimum.
|
||||
@ -1746,12 +1746,12 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* <table cellpadding=5 summary="DTConv">
|
||||
*
|
||||
* <tr><td valign="top">{@code '%'}
|
||||
* <td> The result is a literal {@code '%'} (<tt>'\u0025'</tt>)
|
||||
* <td> The result is a literal {@code '%'} (<code>'\u0025'</code>)
|
||||
*
|
||||
* <p> The width is the minimum number of characters to
|
||||
* be written to the output including the {@code '%'}. If the length of the
|
||||
* converted value is less than the {@code width} then the output will be
|
||||
* padded by spaces (<tt>'\u0020'</tt>) until the total number of
|
||||
* padded by spaces (<code>'\u0020'</code>) until the total number of
|
||||
* characters equals width. The padding is on the left. If width is not
|
||||
* specified then just the {@code '%'} is output.
|
||||
*
|
||||
@ -1801,7 +1801,7 @@ import sun.misc.FormattedFloatingDecimal;
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <li> <i>Relative indexing</i> is used when the format specifier contains a
|
||||
* {@code '<'} (<tt>'\u003c'</tt>) flag which causes the argument for
|
||||
* {@code '<'} (<code>'\u003c'</code>) flag which causes the argument for
|
||||
* the previous format specifier to be re-used. If there is no previous
|
||||
* argument, then a {@link MissingFormatArgumentException} is thrown.
|
||||
*
|
||||
|
||||
@ -28,7 +28,7 @@ package java.util;
|
||||
/**
|
||||
* Unchecked exception thrown when the formatter has been closed.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -36,24 +36,24 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* Hash table based implementation of the <tt>Map</tt> interface. This
|
||||
* Hash table based implementation of the {@code Map} interface. This
|
||||
* implementation provides all of the optional map operations, and permits
|
||||
* <tt>null</tt> values and the <tt>null</tt> key. (The <tt>HashMap</tt>
|
||||
* class is roughly equivalent to <tt>Hashtable</tt>, except that it is
|
||||
* {@code null} values and the {@code null} key. (The {@code HashMap}
|
||||
* class is roughly equivalent to {@code Hashtable}, except that it is
|
||||
* unsynchronized and permits nulls.) This class makes no guarantees as to
|
||||
* the order of the map; in particular, it does not guarantee that the order
|
||||
* will remain constant over time.
|
||||
*
|
||||
* <p>This implementation provides constant-time performance for the basic
|
||||
* operations (<tt>get</tt> and <tt>put</tt>), assuming the hash function
|
||||
* operations ({@code get} and {@code put}), assuming the hash function
|
||||
* disperses the elements properly among the buckets. Iteration over
|
||||
* collection views requires time proportional to the "capacity" of the
|
||||
* <tt>HashMap</tt> instance (the number of buckets) plus its size (the number
|
||||
* {@code HashMap} instance (the number of buckets) plus its size (the number
|
||||
* of key-value mappings). Thus, it's very important not to set the initial
|
||||
* capacity too high (or the load factor too low) if iteration performance is
|
||||
* important.
|
||||
*
|
||||
* <p>An instance of <tt>HashMap</tt> has two parameters that affect its
|
||||
* <p>An instance of {@code HashMap} has two parameters that affect its
|
||||
* performance: <i>initial capacity</i> and <i>load factor</i>. The
|
||||
* <i>capacity</i> is the number of buckets in the hash table, and the initial
|
||||
* capacity is simply the capacity at the time the hash table is created. The
|
||||
@ -67,15 +67,15 @@ import java.util.function.Function;
|
||||
* <p>As a general rule, the default load factor (.75) offers a good
|
||||
* tradeoff between time and space costs. Higher values decrease the
|
||||
* space overhead but increase the lookup cost (reflected in most of
|
||||
* the operations of the <tt>HashMap</tt> class, including
|
||||
* <tt>get</tt> and <tt>put</tt>). The expected number of entries in
|
||||
* the operations of the {@code HashMap} class, including
|
||||
* {@code get} and {@code put}). The expected number of entries in
|
||||
* the map and its load factor should be taken into account when
|
||||
* setting its initial capacity, so as to minimize the number of
|
||||
* rehash operations. If the initial capacity is greater than the
|
||||
* maximum number of entries divided by the load factor, no rehash
|
||||
* operations will ever occur.
|
||||
*
|
||||
* <p>If many mappings are to be stored in a <tt>HashMap</tt>
|
||||
* <p>If many mappings are to be stored in a {@code HashMap}
|
||||
* instance, creating it with a sufficiently large capacity will allow
|
||||
* the mappings to be stored more efficiently than letting it perform
|
||||
* automatic rehashing as needed to grow the table. Note that using
|
||||
@ -102,7 +102,7 @@ import java.util.function.Function;
|
||||
* <p>The iterators returned by all of this class's "collection view methods"
|
||||
* are <i>fail-fast</i>: if the map is structurally modified at any time after
|
||||
* the iterator is created, in any way except through the iterator's own
|
||||
* <tt>remove</tt> method, the iterator will throw a
|
||||
* {@code remove} method, the iterator will throw a
|
||||
* {@link ConcurrentModificationException}. Thus, in the face of concurrent
|
||||
* modification, the iterator fails quickly and cleanly, rather than risking
|
||||
* arbitrary, non-deterministic behavior at an undetermined time in the
|
||||
@ -111,7 +111,7 @@ import java.util.function.Function;
|
||||
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
|
||||
* as it is, generally speaking, impossible to make any hard guarantees in the
|
||||
* presence of unsynchronized concurrent modification. Fail-fast iterators
|
||||
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
|
||||
* throw {@code ConcurrentModificationException} on a best-effort basis.
|
||||
* Therefore, it would be wrong to write a program that depended on this
|
||||
* exception for its correctness: <i>the fail-fast behavior of iterators
|
||||
* should be used only to detect bugs.</i>
|
||||
@ -435,7 +435,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
/* ---------------- Public operations -------------- */
|
||||
|
||||
/**
|
||||
* Constructs an empty <tt>HashMap</tt> with the specified initial
|
||||
* Constructs an empty {@code HashMap} with the specified initial
|
||||
* capacity and load factor.
|
||||
*
|
||||
* @param initialCapacity the initial capacity
|
||||
@ -457,7 +457,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an empty <tt>HashMap</tt> with the specified initial
|
||||
* Constructs an empty {@code HashMap} with the specified initial
|
||||
* capacity and the default load factor (0.75).
|
||||
*
|
||||
* @param initialCapacity the initial capacity.
|
||||
@ -468,7 +468,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an empty <tt>HashMap</tt> with the default initial capacity
|
||||
* Constructs an empty {@code HashMap} with the default initial capacity
|
||||
* (16) and the default load factor (0.75).
|
||||
*/
|
||||
public HashMap() {
|
||||
@ -476,10 +476,10 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <tt>HashMap</tt> with the same mappings as the
|
||||
* specified <tt>Map</tt>. The <tt>HashMap</tt> is created with
|
||||
* Constructs a new {@code HashMap} with the same mappings as the
|
||||
* specified {@code Map}. The {@code HashMap} is created with
|
||||
* default load factor (0.75) and an initial capacity sufficient to
|
||||
* hold the mappings in the specified <tt>Map</tt>.
|
||||
* hold the mappings in the specified {@code Map}.
|
||||
*
|
||||
* @param m the map whose mappings are to be placed in this map
|
||||
* @throws NullPointerException if the specified map is null
|
||||
@ -526,9 +526,9 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map contains no key-value mappings.
|
||||
* Returns {@code true} if this map contains no key-value mappings.
|
||||
*
|
||||
* @return <tt>true</tt> if this map contains no key-value mappings
|
||||
* @return {@code true} if this map contains no key-value mappings
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return size == 0;
|
||||
@ -584,11 +584,11 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map contains a mapping for the
|
||||
* Returns {@code true} if this map contains a mapping for the
|
||||
* specified key.
|
||||
*
|
||||
* @param key The key whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map contains a mapping for the specified
|
||||
* @return {@code true} if this map contains a mapping for the specified
|
||||
* key.
|
||||
*/
|
||||
public boolean containsKey(Object key) {
|
||||
@ -602,10 +602,10 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
*
|
||||
* @param key key with which the specified value is to be associated
|
||||
* @param value value to be associated with the specified key
|
||||
* @return the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* (A <tt>null</tt> return can also indicate that the map
|
||||
* previously associated <tt>null</tt> with <tt>key</tt>.)
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* (A {@code null} return can also indicate that the map
|
||||
* previously associated {@code null} with {@code key}.)
|
||||
*/
|
||||
public V put(K key, V value) {
|
||||
return putVal(hash(key), key, value, false, true);
|
||||
@ -788,10 +788,10 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
* Removes the mapping for the specified key from this map if present.
|
||||
*
|
||||
* @param key key whose mapping is to be removed from the map
|
||||
* @return the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* (A <tt>null</tt> return can also indicate that the map
|
||||
* previously associated <tt>null</tt> with <tt>key</tt>.)
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* (A {@code null} return can also indicate that the map
|
||||
* previously associated {@code null} with {@code key}.)
|
||||
*/
|
||||
public V remove(Object key) {
|
||||
Node<K,V> e;
|
||||
@ -865,11 +865,11 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map maps one or more keys to the
|
||||
* Returns {@code true} if this map maps one or more keys to the
|
||||
* specified value.
|
||||
*
|
||||
* @param value value whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map maps one or more keys to the
|
||||
* @return {@code true} if this map maps one or more keys to the
|
||||
* specified value
|
||||
*/
|
||||
public boolean containsValue(Object value) {
|
||||
@ -891,12 +891,12 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation), the results of
|
||||
* the iterator's own {@code remove} operation), the results of
|
||||
* the iteration are undefined. The set supports element removal,
|
||||
* which removes the corresponding mapping from the map, via the
|
||||
* <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
|
||||
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
|
||||
* operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
|
||||
* {@code Iterator.remove}, {@code Set.remove},
|
||||
* {@code removeAll}, {@code retainAll}, and {@code clear}
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
*
|
||||
* @return a set view of the keys contained in this map
|
||||
@ -938,13 +938,13 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
* The collection is backed by the map, so changes to the map are
|
||||
* reflected in the collection, and vice-versa. If the map is
|
||||
* modified while an iteration over the collection is in progress
|
||||
* (except through the iterator's own <tt>remove</tt> operation),
|
||||
* (except through the iterator's own {@code remove} operation),
|
||||
* the results of the iteration are undefined. The collection
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Collection.remove</tt>, <tt>removeAll</tt>,
|
||||
* <tt>retainAll</tt> and <tt>clear</tt> operations. It does not
|
||||
* support the <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Collection.remove}, {@code removeAll},
|
||||
* {@code retainAll} and {@code clear} operations. It does not
|
||||
* support the {@code add} or {@code addAll} operations.
|
||||
*
|
||||
* @return a view of the values contained in this map
|
||||
*/
|
||||
@ -982,14 +982,14 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation, or through the
|
||||
* <tt>setValue</tt> operation on a map entry returned by the
|
||||
* the iterator's own {@code remove} operation, or through the
|
||||
* {@code setValue} operation on a map entry returned by the
|
||||
* iterator) the results of the iteration are undefined. The set
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
|
||||
* <tt>clear</tt> operations. It does not support the
|
||||
* <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Set.remove}, {@code removeAll}, {@code retainAll} and
|
||||
* {@code clear} operations. It does not support the
|
||||
* {@code add} or {@code addAll} operations.
|
||||
*
|
||||
* @return a set view of the mappings contained in this map
|
||||
*/
|
||||
@ -1357,7 +1357,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
// Cloning and serialization
|
||||
|
||||
/**
|
||||
* Returns a shallow copy of this <tt>HashMap</tt> instance: the keys and
|
||||
* Returns a shallow copy of this {@code HashMap} instance: the keys and
|
||||
* values themselves are not cloned.
|
||||
*
|
||||
* @return a shallow copy of this map
|
||||
@ -1386,7 +1386,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the state of the <tt>HashMap</tt> instance to a stream (i.e.,
|
||||
* Save the state of the {@code HashMap} instance to a stream (i.e.,
|
||||
* serialize it).
|
||||
*
|
||||
* @serialData The <i>capacity</i> of the HashMap (the length of the
|
||||
|
||||
@ -28,18 +28,18 @@ package java.util;
|
||||
import java.io.InvalidObjectException;
|
||||
|
||||
/**
|
||||
* This class implements the <tt>Set</tt> interface, backed by a hash table
|
||||
* (actually a <tt>HashMap</tt> instance). It makes no guarantees as to the
|
||||
* This class implements the {@code Set} interface, backed by a hash table
|
||||
* (actually a {@code HashMap} instance). It makes no guarantees as to the
|
||||
* iteration order of the set; in particular, it does not guarantee that the
|
||||
* order will remain constant over time. This class permits the <tt>null</tt>
|
||||
* order will remain constant over time. This class permits the {@code null}
|
||||
* element.
|
||||
*
|
||||
* <p>This class offers constant time performance for the basic operations
|
||||
* (<tt>add</tt>, <tt>remove</tt>, <tt>contains</tt> and <tt>size</tt>),
|
||||
* ({@code add}, {@code remove}, {@code contains} and {@code size}),
|
||||
* assuming the hash function disperses the elements properly among the
|
||||
* buckets. Iterating over this set requires time proportional to the sum of
|
||||
* the <tt>HashSet</tt> instance's size (the number of elements) plus the
|
||||
* "capacity" of the backing <tt>HashMap</tt> instance (the number of
|
||||
* the {@code HashSet} instance's size (the number of elements) plus the
|
||||
* "capacity" of the backing {@code HashMap} instance (the number of
|
||||
* buckets). Thus, it's very important not to set the initial capacity too
|
||||
* high (or the load factor too low) if iteration performance is important.
|
||||
*
|
||||
@ -55,9 +55,9 @@ import java.io.InvalidObjectException;
|
||||
* unsynchronized access to the set:<pre>
|
||||
* Set s = Collections.synchronizedSet(new HashSet(...));</pre>
|
||||
*
|
||||
* <p>The iterators returned by this class's <tt>iterator</tt> method are
|
||||
* <p>The iterators returned by this class's {@code iterator} method are
|
||||
* <i>fail-fast</i>: if the set is modified at any time after the iterator is
|
||||
* created, in any way except through the iterator's own <tt>remove</tt>
|
||||
* created, in any way except through the iterator's own {@code remove}
|
||||
* method, the Iterator throws a {@link ConcurrentModificationException}.
|
||||
* Thus, in the face of concurrent modification, the iterator fails quickly
|
||||
* and cleanly, rather than risking arbitrary, non-deterministic behavior at
|
||||
@ -66,7 +66,7 @@ import java.io.InvalidObjectException;
|
||||
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
|
||||
* as it is, generally speaking, impossible to make any hard guarantees in the
|
||||
* presence of unsynchronized concurrent modification. Fail-fast iterators
|
||||
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
|
||||
* throw {@code ConcurrentModificationException} on a best-effort basis.
|
||||
* Therefore, it would be wrong to write a program that depended on this
|
||||
* exception for its correctness: <i>the fail-fast behavior of iterators
|
||||
* should be used only to detect bugs.</i>
|
||||
@ -98,7 +98,7 @@ public class HashSet<E>
|
||||
private static final Object PRESENT = new Object();
|
||||
|
||||
/**
|
||||
* Constructs a new, empty set; the backing <tt>HashMap</tt> instance has
|
||||
* Constructs a new, empty set; the backing {@code HashMap} instance has
|
||||
* default initial capacity (16) and load factor (0.75).
|
||||
*/
|
||||
public HashSet() {
|
||||
@ -107,7 +107,7 @@ public class HashSet<E>
|
||||
|
||||
/**
|
||||
* Constructs a new set containing the elements in the specified
|
||||
* collection. The <tt>HashMap</tt> is created with default load factor
|
||||
* collection. The {@code HashMap} is created with default load factor
|
||||
* (0.75) and an initial capacity sufficient to contain the elements in
|
||||
* the specified collection.
|
||||
*
|
||||
@ -120,7 +120,7 @@ public class HashSet<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new, empty set; the backing <tt>HashMap</tt> instance has
|
||||
* Constructs a new, empty set; the backing {@code HashMap} instance has
|
||||
* the specified initial capacity and the specified load factor.
|
||||
*
|
||||
* @param initialCapacity the initial capacity of the hash map
|
||||
@ -133,7 +133,7 @@ public class HashSet<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new, empty set; the backing <tt>HashMap</tt> instance has
|
||||
* Constructs a new, empty set; the backing {@code HashMap} instance has
|
||||
* the specified initial capacity and default load factor (0.75).
|
||||
*
|
||||
* @param initialCapacity the initial capacity of the hash table
|
||||
@ -182,22 +182,22 @@ public class HashSet<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains no elements.
|
||||
* Returns {@code true} if this set contains no elements.
|
||||
*
|
||||
* @return <tt>true</tt> if this set contains no elements
|
||||
* @return {@code true} if this set contains no elements
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return map.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains the specified element.
|
||||
* More formally, returns <tt>true</tt> if and only if this set
|
||||
* contains an element <tt>e</tt> such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>.
|
||||
* Returns {@code true} if this set contains the specified element.
|
||||
* More formally, returns {@code true} if and only if this set
|
||||
* contains an element {@code e} such that
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param o element whose presence in this set is to be tested
|
||||
* @return <tt>true</tt> if this set contains the specified element
|
||||
* @return {@code true} if this set contains the specified element
|
||||
*/
|
||||
public boolean contains(Object o) {
|
||||
return map.containsKey(o);
|
||||
@ -205,14 +205,14 @@ public class HashSet<E>
|
||||
|
||||
/**
|
||||
* Adds the specified element to this set if it is not already present.
|
||||
* More formally, adds the specified element <tt>e</tt> to this set if
|
||||
* this set contains no element <tt>e2</tt> such that
|
||||
* <tt>(e==null ? e2==null : e.equals(e2))</tt>.
|
||||
* More formally, adds the specified element {@code e} to this set if
|
||||
* this set contains no element {@code e2} such that
|
||||
* {@code Objects.equals(e, e2)}.
|
||||
* If this set already contains the element, the call leaves the set
|
||||
* unchanged and returns <tt>false</tt>.
|
||||
* unchanged and returns {@code false}.
|
||||
*
|
||||
* @param e element to be added to this set
|
||||
* @return <tt>true</tt> if this set did not already contain the specified
|
||||
* @return {@code true} if this set did not already contain the specified
|
||||
* element
|
||||
*/
|
||||
public boolean add(E e) {
|
||||
@ -221,15 +221,15 @@ public class HashSet<E>
|
||||
|
||||
/**
|
||||
* Removes the specified element from this set if it is present.
|
||||
* More formally, removes an element <tt>e</tt> such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>,
|
||||
* if this set contains such an element. Returns <tt>true</tt> if
|
||||
* More formally, removes an element {@code e} such that
|
||||
* {@code Objects.equals(o, e)},
|
||||
* if this set contains such an element. Returns {@code true} if
|
||||
* this set contained the element (or equivalently, if this set
|
||||
* changed as a result of the call). (This set will not contain the
|
||||
* element once the call returns.)
|
||||
*
|
||||
* @param o object to be removed from this set, if present
|
||||
* @return <tt>true</tt> if the set contained the specified element
|
||||
* @return {@code true} if the set contained the specified element
|
||||
*/
|
||||
public boolean remove(Object o) {
|
||||
return map.remove(o)==PRESENT;
|
||||
@ -244,7 +244,7 @@ public class HashSet<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a shallow copy of this <tt>HashSet</tt> instance: the elements
|
||||
* Returns a shallow copy of this {@code HashSet} instance: the elements
|
||||
* themselves are not cloned.
|
||||
*
|
||||
* @return a shallow copy of this set
|
||||
@ -261,10 +261,10 @@ public class HashSet<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the state of this <tt>HashSet</tt> instance to a stream (that is,
|
||||
* Save the state of this {@code HashSet} instance to a stream (that is,
|
||||
* serialize it).
|
||||
*
|
||||
* @serialData The capacity of the backing <tt>HashMap</tt> instance
|
||||
* @serialData The capacity of the backing {@code HashMap} instance
|
||||
* (int), and its load factor (float) are emitted, followed by
|
||||
* the size of the set (the number of elements it contains)
|
||||
* (int), followed by all of its elements (each an Object) in
|
||||
@ -288,7 +288,7 @@ public class HashSet<E>
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstitute the <tt>HashSet</tt> instance from a stream (that is,
|
||||
* Reconstitute the {@code HashSet} instance from a stream (that is,
|
||||
* deserialize it).
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
|
||||
@ -32,13 +32,13 @@ import java.util.function.BiFunction;
|
||||
|
||||
/**
|
||||
* This class implements a hash table, which maps keys to values. Any
|
||||
* non-<code>null</code> object can be used as a key or as a value. <p>
|
||||
* non-{@code null} object can be used as a key or as a value. <p>
|
||||
*
|
||||
* To successfully store and retrieve objects from a hashtable, the
|
||||
* objects used as keys must implement the <code>hashCode</code>
|
||||
* method and the <code>equals</code> method. <p>
|
||||
* objects used as keys must implement the {@code hashCode}
|
||||
* method and the {@code equals} method. <p>
|
||||
*
|
||||
* An instance of <code>Hashtable</code> has two parameters that affect its
|
||||
* An instance of {@code Hashtable} has two parameters that affect its
|
||||
* performance: <i>initial capacity</i> and <i>load factor</i>. The
|
||||
* <i>capacity</i> is the number of <i>buckets</i> in the hash table, and the
|
||||
* <i>initial capacity</i> is simply the capacity at the time the hash table
|
||||
@ -53,16 +53,16 @@ import java.util.function.BiFunction;
|
||||
* Generally, the default load factor (.75) offers a good tradeoff between
|
||||
* time and space costs. Higher values decrease the space overhead but
|
||||
* increase the time cost to look up an entry (which is reflected in most
|
||||
* <tt>Hashtable</tt> operations, including <tt>get</tt> and <tt>put</tt>).<p>
|
||||
* {@code Hashtable} operations, including {@code get} and {@code put}).<p>
|
||||
*
|
||||
* The initial capacity controls a tradeoff between wasted space and the
|
||||
* need for <code>rehash</code> operations, which are time-consuming.
|
||||
* No <code>rehash</code> operations will <i>ever</i> occur if the initial
|
||||
* need for {@code rehash} operations, which are time-consuming.
|
||||
* No {@code rehash} operations will <i>ever</i> occur if the initial
|
||||
* capacity is greater than the maximum number of entries the
|
||||
* <tt>Hashtable</tt> will contain divided by its load factor. However,
|
||||
* {@code Hashtable} will contain divided by its load factor. However,
|
||||
* setting the initial capacity too high can waste space.<p>
|
||||
*
|
||||
* If many entries are to be made into a <code>Hashtable</code>,
|
||||
* If many entries are to be made into a {@code Hashtable},
|
||||
* creating it with a sufficiently large capacity may allow the
|
||||
* entries to be inserted more efficiently than letting it perform
|
||||
* automatic rehashing as needed to grow the table. <p>
|
||||
@ -83,11 +83,11 @@ import java.util.function.BiFunction;
|
||||
* System.out.println("two = " + n);
|
||||
* }}</pre>
|
||||
*
|
||||
* <p>The iterators returned by the <tt>iterator</tt> method of the collections
|
||||
* <p>The iterators returned by the {@code iterator} method of the collections
|
||||
* returned by all of this class's "collection view methods" are
|
||||
* <em>fail-fast</em>: if the Hashtable is structurally modified at any time
|
||||
* after the iterator is created, in any way except through the iterator's own
|
||||
* <tt>remove</tt> method, the iterator will throw a {@link
|
||||
* {@code remove} method, the iterator will throw a {@link
|
||||
* ConcurrentModificationException}. Thus, in the face of concurrent
|
||||
* modification, the iterator fails quickly and cleanly, rather than risking
|
||||
* arbitrary, non-deterministic behavior at an undetermined time in the future.
|
||||
@ -99,7 +99,7 @@ import java.util.function.BiFunction;
|
||||
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
|
||||
* as it is, generally speaking, impossible to make any hard guarantees in the
|
||||
* presence of unsynchronized concurrent modification. Fail-fast iterators
|
||||
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
|
||||
* throw {@code ConcurrentModificationException} on a best-effort basis.
|
||||
* Therefore, it would be wrong to write a program that depended on this
|
||||
* exception for its correctness: <i>the fail-fast behavior of iterators
|
||||
* should be used only to detect bugs.</i>
|
||||
@ -241,8 +241,8 @@ public class Hashtable<K,V>
|
||||
/**
|
||||
* Tests if this hashtable maps no keys to values.
|
||||
*
|
||||
* @return <code>true</code> if this hashtable maps no keys to values;
|
||||
* <code>false</code> otherwise.
|
||||
* @return {@code true} if this hashtable maps no keys to values;
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
public synchronized boolean isEmpty() {
|
||||
return count == 0;
|
||||
@ -290,11 +290,11 @@ public class Hashtable<K,V>
|
||||
* {@link Map} interface in the collections framework).
|
||||
*
|
||||
* @param value a value to search for
|
||||
* @return <code>true</code> if and only if some key maps to the
|
||||
* <code>value</code> argument in this hashtable as
|
||||
* determined by the <tt>equals</tt> method;
|
||||
* <code>false</code> otherwise.
|
||||
* @exception NullPointerException if the value is <code>null</code>
|
||||
* @return {@code true} if and only if some key maps to the
|
||||
* {@code value} argument in this hashtable as
|
||||
* determined by the {@code equals} method;
|
||||
* {@code false} otherwise.
|
||||
* @exception NullPointerException if the value is {@code null}
|
||||
*/
|
||||
public synchronized boolean contains(Object value) {
|
||||
if (value == null) {
|
||||
@ -319,9 +319,9 @@ public class Hashtable<K,V>
|
||||
* #contains contains} (which predates the {@link Map} interface).
|
||||
*
|
||||
* @param value value whose presence in this hashtable is to be tested
|
||||
* @return <tt>true</tt> if this map maps one or more keys to the
|
||||
* @return {@code true} if this map maps one or more keys to the
|
||||
* specified value
|
||||
* @throws NullPointerException if the value is <code>null</code>
|
||||
* @throws NullPointerException if the value is {@code null}
|
||||
* @since 1.2
|
||||
*/
|
||||
public boolean containsValue(Object value) {
|
||||
@ -332,10 +332,10 @@ public class Hashtable<K,V>
|
||||
* Tests if the specified object is a key in this hashtable.
|
||||
*
|
||||
* @param key possible key
|
||||
* @return <code>true</code> if and only if the specified object
|
||||
* @return {@code true} if and only if the specified object
|
||||
* is a key in this hashtable, as determined by the
|
||||
* <tt>equals</tt> method; <code>false</code> otherwise.
|
||||
* @throws NullPointerException if the key is <code>null</code>
|
||||
* {@code equals} method; {@code false} otherwise.
|
||||
* @throws NullPointerException if the key is {@code null}
|
||||
* @see #contains(Object)
|
||||
*/
|
||||
public synchronized boolean containsKey(Object key) {
|
||||
@ -444,19 +444,19 @@ public class Hashtable<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps the specified <code>key</code> to the specified
|
||||
* <code>value</code> in this hashtable. Neither the key nor the
|
||||
* value can be <code>null</code>. <p>
|
||||
* Maps the specified {@code key} to the specified
|
||||
* {@code value} in this hashtable. Neither the key nor the
|
||||
* value can be {@code null}. <p>
|
||||
*
|
||||
* The value can be retrieved by calling the <code>get</code> method
|
||||
* The value can be retrieved by calling the {@code get} method
|
||||
* with a key that is equal to the original key.
|
||||
*
|
||||
* @param key the hashtable key
|
||||
* @param value the value
|
||||
* @return the previous value of the specified key in this hashtable,
|
||||
* or <code>null</code> if it did not have one
|
||||
* or {@code null} if it did not have one
|
||||
* @exception NullPointerException if the key or value is
|
||||
* <code>null</code>
|
||||
* {@code null}
|
||||
* @see Object#equals(Object)
|
||||
* @see #get(Object)
|
||||
*/
|
||||
@ -490,8 +490,8 @@ public class Hashtable<K,V>
|
||||
*
|
||||
* @param key the key that needs to be removed
|
||||
* @return the value to which the key had been mapped in this hashtable,
|
||||
* or <code>null</code> if the key did not have a mapping
|
||||
* @throws NullPointerException if the key is <code>null</code>
|
||||
* or {@code null} if the key did not have a mapping
|
||||
* @throws NullPointerException if the key is {@code null}
|
||||
*/
|
||||
public synchronized V remove(Object key) {
|
||||
Entry<?,?> tab[] = table;
|
||||
@ -568,11 +568,11 @@ public class Hashtable<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this <tt>Hashtable</tt> object
|
||||
* Returns a string representation of this {@code Hashtable} object
|
||||
* in the form of a set of entries, enclosed in braces and separated
|
||||
* by the ASCII characters "<tt>, </tt>" (comma and space). Each
|
||||
* entry is rendered as the key, an equals sign <tt>=</tt>, and the
|
||||
* associated element, where the <tt>toString</tt> method is used to
|
||||
* by the ASCII characters "<code> , </code>" (comma and space). Each
|
||||
* entry is rendered as the key, an equals sign {@code =}, and the
|
||||
* associated element, where the {@code toString} method is used to
|
||||
* convert the key and element to strings.
|
||||
*
|
||||
* @return a string representation of this hashtable
|
||||
@ -633,12 +633,12 @@ public class Hashtable<K,V>
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation), the results of
|
||||
* the iterator's own {@code remove} operation), the results of
|
||||
* the iteration are undefined. The set supports element removal,
|
||||
* which removes the corresponding mapping from the map, via the
|
||||
* <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
|
||||
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
|
||||
* operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
|
||||
* {@code Iterator.remove}, {@code Set.remove},
|
||||
* {@code removeAll}, {@code retainAll}, and {@code clear}
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
*
|
||||
* @since 1.2
|
||||
@ -672,14 +672,14 @@ public class Hashtable<K,V>
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation, or through the
|
||||
* <tt>setValue</tt> operation on a map entry returned by the
|
||||
* the iterator's own {@code remove} operation, or through the
|
||||
* {@code setValue} operation on a map entry returned by the
|
||||
* iterator) the results of the iteration are undefined. The set
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
|
||||
* <tt>clear</tt> operations. It does not support the
|
||||
* <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Set.remove}, {@code removeAll}, {@code retainAll} and
|
||||
* {@code clear} operations. It does not support the
|
||||
* {@code add} or {@code addAll} operations.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
@ -754,13 +754,13 @@ public class Hashtable<K,V>
|
||||
* The collection is backed by the map, so changes to the map are
|
||||
* reflected in the collection, and vice-versa. If the map is
|
||||
* modified while an iteration over the collection is in progress
|
||||
* (except through the iterator's own <tt>remove</tt> operation),
|
||||
* (except through the iterator's own {@code remove} operation),
|
||||
* the results of the iteration are undefined. The collection
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Collection.remove</tt>, <tt>removeAll</tt>,
|
||||
* <tt>retainAll</tt> and <tt>clear</tt> operations. It does not
|
||||
* support the <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Collection.remove}, {@code removeAll},
|
||||
* {@code retainAll} and {@code clear} operations. It does not
|
||||
* support the {@code add} or {@code addAll} operations.
|
||||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
|
||||
@ -31,18 +31,18 @@ import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* This class implements the <tt>Map</tt> interface with a hash table, using
|
||||
* This class implements the {@code Map} interface with a hash table, using
|
||||
* reference-equality in place of object-equality when comparing keys (and
|
||||
* values). In other words, in an <tt>IdentityHashMap</tt>, two keys
|
||||
* <tt>k1</tt> and <tt>k2</tt> are considered equal if and only if
|
||||
* <tt>(k1==k2)</tt>. (In normal <tt>Map</tt> implementations (like
|
||||
* <tt>HashMap</tt>) two keys <tt>k1</tt> and <tt>k2</tt> are considered equal
|
||||
* if and only if <tt>(k1==null ? k2==null : k1.equals(k2))</tt>.)
|
||||
* values). In other words, in an {@code IdentityHashMap}, two keys
|
||||
* {@code k1} and {@code k2} are considered equal if and only if
|
||||
* {@code (k1==k2)}. (In normal {@code Map} implementations (like
|
||||
* {@code HashMap}) two keys {@code k1} and {@code k2} are considered equal
|
||||
* if and only if {@code (k1==null ? k2==null : k1.equals(k2))}.)
|
||||
*
|
||||
* <p><b>This class is <i>not</i> a general-purpose <tt>Map</tt>
|
||||
* implementation! While this class implements the <tt>Map</tt> interface, it
|
||||
* intentionally violates <tt>Map's</tt> general contract, which mandates the
|
||||
* use of the <tt>equals</tt> method when comparing objects. This class is
|
||||
* <p><b>This class is <i>not</i> a general-purpose {@code Map}
|
||||
* implementation! While this class implements the {@code Map} interface, it
|
||||
* intentionally violates {@code Map's} general contract, which mandates the
|
||||
* use of the {@code equals} method when comparing objects. This class is
|
||||
* designed for use only in the rare cases wherein reference-equality
|
||||
* semantics are required.</b>
|
||||
*
|
||||
@ -56,12 +56,12 @@ import java.util.function.Consumer;
|
||||
* each object in the program being debugged.
|
||||
*
|
||||
* <p>This class provides all of the optional map operations, and permits
|
||||
* <tt>null</tt> values and the <tt>null</tt> key. This class makes no
|
||||
* {@code null} values and the {@code null} key. This class makes no
|
||||
* guarantees as to the order of the map; in particular, it does not guarantee
|
||||
* that the order will remain constant over time.
|
||||
*
|
||||
* <p>This class provides constant-time performance for the basic
|
||||
* operations (<tt>get</tt> and <tt>put</tt>), assuming the system
|
||||
* operations ({@code get} and {@code put}), assuming the system
|
||||
* identity hash function ({@link System#identityHashCode(Object)})
|
||||
* disperses elements properly among the buckets.
|
||||
*
|
||||
@ -96,11 +96,11 @@ import java.util.function.Consumer;
|
||||
* unsynchronized access to the map:<pre>
|
||||
* Map m = Collections.synchronizedMap(new IdentityHashMap(...));</pre>
|
||||
*
|
||||
* <p>The iterators returned by the <tt>iterator</tt> method of the
|
||||
* <p>The iterators returned by the {@code iterator} method of the
|
||||
* collections returned by all of this class's "collection view
|
||||
* methods" are <i>fail-fast</i>: if the map is structurally modified
|
||||
* at any time after the iterator is created, in any way except
|
||||
* through the iterator's own <tt>remove</tt> method, the iterator
|
||||
* through the iterator's own {@code remove} method, the iterator
|
||||
* will throw a {@link ConcurrentModificationException}. Thus, in the
|
||||
* face of concurrent modification, the iterator fails quickly and
|
||||
* cleanly, rather than risking arbitrary, non-deterministic behavior
|
||||
@ -109,7 +109,7 @@ import java.util.function.Consumer;
|
||||
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
|
||||
* as it is, generally speaking, impossible to make any hard guarantees in the
|
||||
* presence of unsynchronized concurrent modification. Fail-fast iterators
|
||||
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
|
||||
* throw {@code ConcurrentModificationException} on a best-effort basis.
|
||||
* Therefore, it would be wrong to write a program that depended on this
|
||||
* exception for its correctness: <i>fail-fast iterators should be used only
|
||||
* to detect bugs.</i>
|
||||
@ -217,7 +217,7 @@ public class IdentityHashMap<K,V>
|
||||
* somewhat time-consuming.
|
||||
*
|
||||
* @param expectedMaxSize the expected maximum size of the map
|
||||
* @throws IllegalArgumentException if <tt>expectedMaxSize</tt> is negative
|
||||
* @throws IllegalArgumentException if {@code expectedMaxSize} is negative
|
||||
*/
|
||||
public IdentityHashMap(int expectedMaxSize) {
|
||||
if (expectedMaxSize < 0)
|
||||
@ -277,10 +277,10 @@ public class IdentityHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this identity hash map contains no key-value
|
||||
* Returns {@code true} if this identity hash map contains no key-value
|
||||
* mappings.
|
||||
*
|
||||
* @return <tt>true</tt> if this identity hash map contains no key-value
|
||||
* @return {@code true} if this identity hash map contains no key-value
|
||||
* mappings
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
@ -341,7 +341,7 @@ public class IdentityHashMap<K,V>
|
||||
* hash map.
|
||||
*
|
||||
* @param key possible key
|
||||
* @return <code>true</code> if the specified object reference is a key
|
||||
* @return {@code true} if the specified object reference is a key
|
||||
* in this map
|
||||
* @see #containsValue(Object)
|
||||
*/
|
||||
@ -365,7 +365,7 @@ public class IdentityHashMap<K,V>
|
||||
* hash map.
|
||||
*
|
||||
* @param value value whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map maps one or more keys to the
|
||||
* @return {@code true} if this map maps one or more keys to the
|
||||
* specified object reference
|
||||
* @see #containsKey(Object)
|
||||
*/
|
||||
@ -383,7 +383,7 @@ public class IdentityHashMap<K,V>
|
||||
*
|
||||
* @param key possible key
|
||||
* @param value possible value
|
||||
* @return <code>true</code> if and only if the specified key-value
|
||||
* @return {@code true} if and only if the specified key-value
|
||||
* mapping is in the map
|
||||
*/
|
||||
private boolean containsMapping(Object key, Object value) {
|
||||
@ -408,10 +408,10 @@ public class IdentityHashMap<K,V>
|
||||
*
|
||||
* @param key the key with which the specified value is to be associated
|
||||
* @param value the value to be associated with the specified key
|
||||
* @return the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* (A <tt>null</tt> return can also indicate that the map
|
||||
* previously associated <tt>null</tt> with <tt>key</tt>.)
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* (A {@code null} return can also indicate that the map
|
||||
* previously associated {@code null} with {@code key}.)
|
||||
* @see Object#equals(Object)
|
||||
* @see #get(Object)
|
||||
* @see #containsKey(Object)
|
||||
@ -510,10 +510,10 @@ public class IdentityHashMap<K,V>
|
||||
* Removes the mapping for this key from this map if present.
|
||||
*
|
||||
* @param key key whose mapping is to be removed from the map
|
||||
* @return the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* (A <tt>null</tt> return can also indicate that the map
|
||||
* previously associated <tt>null</tt> with <tt>key</tt>.)
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* (A {@code null} return can also indicate that the map
|
||||
* previously associated {@code null} with {@code key}.)
|
||||
*/
|
||||
public V remove(Object key) {
|
||||
Object k = maskNull(key);
|
||||
@ -544,7 +544,7 @@ public class IdentityHashMap<K,V>
|
||||
*
|
||||
* @param key possible key
|
||||
* @param value possible value
|
||||
* @return <code>true</code> if and only if the specified key-value
|
||||
* @return {@code true} if and only if the specified key-value
|
||||
* mapping was in the map
|
||||
*/
|
||||
private boolean removeMapping(Object key, Object value) {
|
||||
@ -621,19 +621,19 @@ public class IdentityHashMap<K,V>
|
||||
|
||||
/**
|
||||
* Compares the specified object with this map for equality. Returns
|
||||
* <tt>true</tt> if the given object is also a map and the two maps
|
||||
* {@code true} if the given object is also a map and the two maps
|
||||
* represent identical object-reference mappings. More formally, this
|
||||
* map is equal to another map <tt>m</tt> if and only if
|
||||
* <tt>this.entrySet().equals(m.entrySet())</tt>.
|
||||
* map is equal to another map {@code m} if and only if
|
||||
* {@code this.entrySet().equals(m.entrySet())}.
|
||||
*
|
||||
* <p><b>Owing to the reference-equality-based semantics of this map it is
|
||||
* possible that the symmetry and transitivity requirements of the
|
||||
* <tt>Object.equals</tt> contract may be violated if this map is compared
|
||||
* to a normal map. However, the <tt>Object.equals</tt> contract is
|
||||
* guaranteed to hold among <tt>IdentityHashMap</tt> instances.</b>
|
||||
* {@code Object.equals} contract may be violated if this map is compared
|
||||
* to a normal map. However, the {@code Object.equals} contract is
|
||||
* guaranteed to hold among {@code IdentityHashMap} instances.</b>
|
||||
*
|
||||
* @param o object to be compared for equality with this map
|
||||
* @return <tt>true</tt> if the specified object is equal to this map
|
||||
* @return {@code true} if the specified object is equal to this map
|
||||
* @see Object#equals(Object)
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
@ -662,17 +662,17 @@ public class IdentityHashMap<K,V>
|
||||
/**
|
||||
* Returns the hash code value for this map. The hash code of a map is
|
||||
* defined to be the sum of the hash codes of each entry in the map's
|
||||
* <tt>entrySet()</tt> view. This ensures that <tt>m1.equals(m2)</tt>
|
||||
* implies that <tt>m1.hashCode()==m2.hashCode()</tt> for any two
|
||||
* <tt>IdentityHashMap</tt> instances <tt>m1</tt> and <tt>m2</tt>, as
|
||||
* {@code entrySet()} view. This ensures that {@code m1.equals(m2)}
|
||||
* implies that {@code m1.hashCode()==m2.hashCode()} for any two
|
||||
* {@code IdentityHashMap} instances {@code m1} and {@code m2}, as
|
||||
* required by the general contract of {@link Object#hashCode}.
|
||||
*
|
||||
* <p><b>Owing to the reference-equality-based semantics of the
|
||||
* <tt>Map.Entry</tt> instances in the set returned by this map's
|
||||
* <tt>entrySet</tt> method, it is possible that the contractual
|
||||
* requirement of <tt>Object.hashCode</tt> mentioned in the previous
|
||||
* {@code Map.Entry} instances in the set returned by this map's
|
||||
* {@code entrySet} method, it is possible that the contractual
|
||||
* requirement of {@code Object.hashCode} mentioned in the previous
|
||||
* paragraph will be violated if one of the two objects being compared is
|
||||
* an <tt>IdentityHashMap</tt> instance and the other is a normal map.</b>
|
||||
* an {@code IdentityHashMap} instance and the other is a normal map.</b>
|
||||
*
|
||||
* @return the hash code value for this map
|
||||
* @see Object#equals(Object)
|
||||
@ -930,32 +930,32 @@ public class IdentityHashMap<K,V>
|
||||
* the set, and vice-versa. If the map is modified while an iteration
|
||||
* over the set is in progress, the results of the iteration are
|
||||
* undefined. The set supports element removal, which removes the
|
||||
* corresponding mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt>, and
|
||||
* <tt>clear</tt> methods. It does not support the <tt>add</tt> or
|
||||
* <tt>addAll</tt> methods.
|
||||
* corresponding mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Set.remove}, {@code removeAll}, {@code retainAll}, and
|
||||
* {@code clear} methods. It does not support the {@code add} or
|
||||
* {@code addAll} methods.
|
||||
*
|
||||
* <p><b>While the object returned by this method implements the
|
||||
* <tt>Set</tt> interface, it does <i>not</i> obey <tt>Set's</tt> general
|
||||
* {@code Set} interface, it does <i>not</i> obey {@code Set's} general
|
||||
* contract. Like its backing map, the set returned by this method
|
||||
* defines element equality as reference-equality rather than
|
||||
* object-equality. This affects the behavior of its <tt>contains</tt>,
|
||||
* <tt>remove</tt>, <tt>containsAll</tt>, <tt>equals</tt>, and
|
||||
* <tt>hashCode</tt> methods.</b>
|
||||
* object-equality. This affects the behavior of its {@code contains},
|
||||
* {@code remove}, {@code containsAll}, {@code equals}, and
|
||||
* {@code hashCode} methods.</b>
|
||||
*
|
||||
* <p><b>The <tt>equals</tt> method of the returned set returns <tt>true</tt>
|
||||
* <p><b>The {@code equals} method of the returned set returns {@code true}
|
||||
* only if the specified object is a set containing exactly the same
|
||||
* object references as the returned set. The symmetry and transitivity
|
||||
* requirements of the <tt>Object.equals</tt> contract may be violated if
|
||||
* requirements of the {@code Object.equals} contract may be violated if
|
||||
* the set returned by this method is compared to a normal set. However,
|
||||
* the <tt>Object.equals</tt> contract is guaranteed to hold among sets
|
||||
* the {@code Object.equals} contract is guaranteed to hold among sets
|
||||
* returned by this method.</b>
|
||||
*
|
||||
* <p>The <tt>hashCode</tt> method of the returned set returns the sum of
|
||||
* <p>The {@code hashCode} method of the returned set returns the sum of
|
||||
* the <i>identity hashcodes</i> of the elements in the set, rather than
|
||||
* the sum of their hashcodes. This is mandated by the change in the
|
||||
* semantics of the <tt>equals</tt> method, in order to enforce the
|
||||
* general contract of the <tt>Object.hashCode</tt> method among sets
|
||||
* semantics of the {@code equals} method, in order to enforce the
|
||||
* general contract of the {@code Object.hashCode} method among sets
|
||||
* returned by this method.
|
||||
*
|
||||
* @return an identity-based set view of the keys contained in this map
|
||||
@ -1054,18 +1054,18 @@ public class IdentityHashMap<K,V>
|
||||
* modified while an iteration over the collection is in progress,
|
||||
* the results of the iteration are undefined. The collection
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Collection.remove</tt>, <tt>removeAll</tt>,
|
||||
* <tt>retainAll</tt> and <tt>clear</tt> methods. It does not
|
||||
* support the <tt>add</tt> or <tt>addAll</tt> methods.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Collection.remove}, {@code removeAll},
|
||||
* {@code retainAll} and {@code clear} methods. It does not
|
||||
* support the {@code add} or {@code addAll} methods.
|
||||
*
|
||||
* <p><b>While the object returned by this method implements the
|
||||
* <tt>Collection</tt> interface, it does <i>not</i> obey
|
||||
* <tt>Collection's</tt> general contract. Like its backing map,
|
||||
* {@code Collection} interface, it does <i>not</i> obey
|
||||
* {@code Collection's} general contract. Like its backing map,
|
||||
* the collection returned by this method defines element equality as
|
||||
* reference-equality rather than object-equality. This affects the
|
||||
* behavior of its <tt>contains</tt>, <tt>remove</tt> and
|
||||
* <tt>containsAll</tt> methods.</b>
|
||||
* behavior of its {@code contains}, {@code remove} and
|
||||
* {@code containsAll} methods.</b>
|
||||
*/
|
||||
public Collection<V> values() {
|
||||
Collection<V> vs = values;
|
||||
@ -1136,36 +1136,36 @@ public class IdentityHashMap<K,V>
|
||||
/**
|
||||
* Returns a {@link Set} view of the mappings contained in this map.
|
||||
* Each element in the returned set is a reference-equality-based
|
||||
* <tt>Map.Entry</tt>. The set is backed by the map, so changes
|
||||
* {@code Map.Entry}. The set is backed by the map, so changes
|
||||
* to the map are reflected in the set, and vice-versa. If the
|
||||
* map is modified while an iteration over the set is in progress,
|
||||
* the results of the iteration are undefined. The set supports
|
||||
* element removal, which removes the corresponding mapping from
|
||||
* the map, via the <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
|
||||
* <tt>removeAll</tt>, <tt>retainAll</tt> and <tt>clear</tt>
|
||||
* methods. It does not support the <tt>add</tt> or
|
||||
* <tt>addAll</tt> methods.
|
||||
* the map, via the {@code Iterator.remove}, {@code Set.remove},
|
||||
* {@code removeAll}, {@code retainAll} and {@code clear}
|
||||
* methods. It does not support the {@code add} or
|
||||
* {@code addAll} methods.
|
||||
*
|
||||
* <p>Like the backing map, the <tt>Map.Entry</tt> objects in the set
|
||||
* <p>Like the backing map, the {@code Map.Entry} objects in the set
|
||||
* returned by this method define key and value equality as
|
||||
* reference-equality rather than object-equality. This affects the
|
||||
* behavior of the <tt>equals</tt> and <tt>hashCode</tt> methods of these
|
||||
* <tt>Map.Entry</tt> objects. A reference-equality based <tt>Map.Entry
|
||||
* e</tt> is equal to an object <tt>o</tt> if and only if <tt>o</tt> is a
|
||||
* <tt>Map.Entry</tt> and <tt>e.getKey()==o.getKey() &&
|
||||
* e.getValue()==o.getValue()</tt>. To accommodate these equals
|
||||
* semantics, the <tt>hashCode</tt> method returns
|
||||
* <tt>System.identityHashCode(e.getKey()) ^
|
||||
* System.identityHashCode(e.getValue())</tt>.
|
||||
* behavior of the {@code equals} and {@code hashCode} methods of these
|
||||
* {@code Map.Entry} objects. A reference-equality based {@code Map.Entry
|
||||
* e} is equal to an object {@code o} if and only if {@code o} is a
|
||||
* {@code Map.Entry} and {@code e.getKey()==o.getKey() &&
|
||||
* e.getValue()==o.getValue()}. To accommodate these equals
|
||||
* semantics, the {@code hashCode} method returns
|
||||
* {@code System.identityHashCode(e.getKey()) ^
|
||||
* System.identityHashCode(e.getValue())}.
|
||||
*
|
||||
* <p><b>Owing to the reference-equality-based semantics of the
|
||||
* <tt>Map.Entry</tt> instances in the set returned by this method,
|
||||
* {@code Map.Entry} instances in the set returned by this method,
|
||||
* it is possible that the symmetry and transitivity requirements of
|
||||
* the {@link Object#equals(Object)} contract may be violated if any of
|
||||
* the entries in the set is compared to a normal map entry, or if
|
||||
* the set returned by this method is compared to a set of normal map
|
||||
* entries (such as would be returned by a call to this method on a normal
|
||||
* map). However, the <tt>Object.equals</tt> contract is guaranteed to
|
||||
* map). However, the {@code Object.equals} contract is guaranteed to
|
||||
* hold among identity-based map entries, and among sets of such entries.
|
||||
* </b>
|
||||
*
|
||||
@ -1260,11 +1260,11 @@ public class IdentityHashMap<K,V>
|
||||
private static final long serialVersionUID = 8188218128353913216L;
|
||||
|
||||
/**
|
||||
* Saves the state of the <tt>IdentityHashMap</tt> instance to a stream
|
||||
* Saves the state of the {@code IdentityHashMap} instance to a stream
|
||||
* (i.e., serializes it).
|
||||
*
|
||||
* @serialData The <i>size</i> of the HashMap (the number of key-value
|
||||
* mappings) (<tt>int</tt>), followed by the key (Object) and
|
||||
* mappings) ({@code int}), followed by the key (Object) and
|
||||
* value (Object) for each key-value mapping represented by the
|
||||
* IdentityHashMap. The key-value mappings are emitted in no
|
||||
* particular order.
|
||||
@ -1289,7 +1289,7 @@ public class IdentityHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Reconstitutes the <tt>IdentityHashMap</tt> instance from a stream (i.e.,
|
||||
* Reconstitutes the {@code IdentityHashMap} instance from a stream (i.e.,
|
||||
* deserializes it).
|
||||
*/
|
||||
private void readObject(java.io.ObjectInputStream s)
|
||||
|
||||
@ -30,7 +30,7 @@ package java.util;
|
||||
* point as defined by {@link Character#isValidCodePoint} is passed to the
|
||||
* {@link Formatter}.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -29,7 +29,7 @@ package java.util;
|
||||
* Unchecked exception thrown when the argument corresponding to the format
|
||||
* specifier is of an incompatible type.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -28,7 +28,7 @@ package java.util;
|
||||
/**
|
||||
* Unchecked exception thrown when an illegal combination flags is given.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -27,7 +27,7 @@ package java.util;
|
||||
|
||||
/**
|
||||
* Unchecked exception thrown when the precision is a negative value other than
|
||||
* <tt>-1</tt>, the conversion does not support a precision, or the value is
|
||||
* {@code -1}, the conversion does not support a precision, or the value is
|
||||
* otherwise unsupported.
|
||||
*
|
||||
* @since 1.5
|
||||
|
||||
@ -27,7 +27,7 @@ package java.util;
|
||||
|
||||
/**
|
||||
* Unchecked exception thrown when the format width is a negative value other
|
||||
* than <tt>-1</tt> or is otherwise unsupported.
|
||||
* than {@code -1} or is otherwise unsupported.
|
||||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* Thrown by a <code>Scanner</code> to indicate that the token
|
||||
* Thrown by a {@code Scanner} to indicate that the token
|
||||
* retrieved does not match the pattern for the expected type, or
|
||||
* that the token is out of range for the expected type.
|
||||
*
|
||||
@ -39,7 +39,7 @@ class InputMismatchException extends NoSuchElementException {
|
||||
private static final long serialVersionUID = 8811230760997066428L;
|
||||
|
||||
/**
|
||||
* Constructs an <code>InputMismatchException</code> with <tt>null</tt>
|
||||
* Constructs an {@code InputMismatchException} with {@code null}
|
||||
* as its error message string.
|
||||
*/
|
||||
public InputMismatchException() {
|
||||
@ -47,9 +47,9 @@ class InputMismatchException extends NoSuchElementException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an <code>InputMismatchException</code>, saving a reference
|
||||
* to the error message string <tt>s</tt> for later retrieval by the
|
||||
* <tt>getMessage</tt> method.
|
||||
* Constructs an {@code InputMismatchException}, saving a reference
|
||||
* to the error message string {@code s} for later retrieval by the
|
||||
* {@code getMessage} method.
|
||||
*
|
||||
* @param s the detail message.
|
||||
*/
|
||||
|
||||
@ -163,19 +163,19 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains no elements.
|
||||
* Returns {@code true} if this set contains no elements.
|
||||
*
|
||||
* @return <tt>true</tt> if this set contains no elements
|
||||
* @return {@code true} if this set contains no elements
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return size == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains the specified element.
|
||||
* Returns {@code true} if this set contains the specified element.
|
||||
*
|
||||
* @param e element to be checked for containment in this collection
|
||||
* @return <tt>true</tt> if this set contains the specified element
|
||||
* @return {@code true} if this set contains the specified element
|
||||
*/
|
||||
public boolean contains(Object e) {
|
||||
if (e == null)
|
||||
@ -194,9 +194,9 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* Adds the specified element to this set if it is not already present.
|
||||
*
|
||||
* @param e element to be added to this set
|
||||
* @return <tt>true</tt> if the set changed as a result of the call
|
||||
* @return {@code true} if the set changed as a result of the call
|
||||
*
|
||||
* @throws NullPointerException if <tt>e</tt> is null
|
||||
* @throws NullPointerException if {@code e} is null
|
||||
*/
|
||||
public boolean add(E e) {
|
||||
typeCheck(e);
|
||||
@ -216,7 +216,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* Removes the specified element from this set if it is present.
|
||||
*
|
||||
* @param e element to be removed from this set, if present
|
||||
* @return <tt>true</tt> if the set contained the specified element
|
||||
* @return {@code true} if the set contained the specified element
|
||||
*/
|
||||
public boolean remove(Object e) {
|
||||
if (e == null)
|
||||
@ -238,11 +238,11 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
// Bulk Operations
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains all of the elements
|
||||
* Returns {@code true} if this set contains all of the elements
|
||||
* in the specified collection.
|
||||
*
|
||||
* @param c collection to be checked for containment in this set
|
||||
* @return <tt>true</tt> if this set contains all of the elements
|
||||
* @return {@code true} if this set contains all of the elements
|
||||
* in the specified collection
|
||||
* @throws NullPointerException if the specified collection is null
|
||||
*/
|
||||
@ -264,7 +264,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* Adds all of the elements in the specified collection to this set.
|
||||
*
|
||||
* @param c collection whose elements are to be added to this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws NullPointerException if the specified collection or any of
|
||||
* its elements are null
|
||||
*/
|
||||
@ -291,7 +291,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* the specified collection.
|
||||
*
|
||||
* @param c elements to be removed from this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws NullPointerException if the specified collection is null
|
||||
*/
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
@ -312,7 +312,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* specified collection.
|
||||
*
|
||||
* @param c elements to be retained in this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws NullPointerException if the specified collection is null
|
||||
*/
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
@ -341,12 +341,12 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
|
||||
/**
|
||||
* Compares the specified object with this set for equality. Returns
|
||||
* <tt>true</tt> if the given object is also a set, the two sets have
|
||||
* {@code true} if the given object is also a set, the two sets have
|
||||
* the same size, and every member of the given set is contained in
|
||||
* this set.
|
||||
*
|
||||
* @param o object to be compared for equality with this set
|
||||
* @return <tt>true</tt> if the specified object is equal to this set
|
||||
* @return {@code true} if the specified object is equal to this set
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof JumboEnumSet))
|
||||
|
||||
@ -31,15 +31,15 @@ import java.util.function.BiFunction;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* <p>Hash table and linked list implementation of the <tt>Map</tt> interface,
|
||||
* <p>Hash table and linked list implementation of the {@code Map} interface,
|
||||
* with predictable iteration order. This implementation differs from
|
||||
* <tt>HashMap</tt> in that it maintains a doubly-linked list running through
|
||||
* {@code HashMap} in that it maintains a doubly-linked list running through
|
||||
* all of its entries. This linked list defines the iteration ordering,
|
||||
* which is normally the order in which keys were inserted into the map
|
||||
* (<i>insertion-order</i>). Note that insertion order is not affected
|
||||
* if a key is <i>re-inserted</i> into the map. (A key <tt>k</tt> is
|
||||
* reinserted into a map <tt>m</tt> if <tt>m.put(k, v)</tt> is invoked when
|
||||
* <tt>m.containsKey(k)</tt> would return <tt>true</tt> immediately prior to
|
||||
* if a key is <i>re-inserted</i> into the map. (A key {@code k} is
|
||||
* reinserted into a map {@code m} if {@code m.put(k, v)} is invoked when
|
||||
* {@code m.containsKey(k)} would return {@code true} immediately prior to
|
||||
* the invocation.)
|
||||
*
|
||||
* <p>This implementation spares its clients from the unspecified, generally
|
||||
@ -78,23 +78,23 @@ import java.io.IOException;
|
||||
* impose a policy for removing stale mappings automatically when new mappings
|
||||
* are added to the map.
|
||||
*
|
||||
* <p>This class provides all of the optional <tt>Map</tt> operations, and
|
||||
* permits null elements. Like <tt>HashMap</tt>, it provides constant-time
|
||||
* performance for the basic operations (<tt>add</tt>, <tt>contains</tt> and
|
||||
* <tt>remove</tt>), assuming the hash function disperses elements
|
||||
* <p>This class provides all of the optional {@code Map} operations, and
|
||||
* permits null elements. Like {@code HashMap}, it provides constant-time
|
||||
* performance for the basic operations ({@code add}, {@code contains} and
|
||||
* {@code remove}), assuming the hash function disperses elements
|
||||
* properly among the buckets. Performance is likely to be just slightly
|
||||
* below that of <tt>HashMap</tt>, due to the added expense of maintaining the
|
||||
* below that of {@code HashMap}, due to the added expense of maintaining the
|
||||
* linked list, with one exception: Iteration over the collection-views
|
||||
* of a <tt>LinkedHashMap</tt> requires time proportional to the <i>size</i>
|
||||
* of the map, regardless of its capacity. Iteration over a <tt>HashMap</tt>
|
||||
* of a {@code LinkedHashMap} requires time proportional to the <i>size</i>
|
||||
* of the map, regardless of its capacity. Iteration over a {@code HashMap}
|
||||
* is likely to be more expensive, requiring time proportional to its
|
||||
* <i>capacity</i>.
|
||||
*
|
||||
* <p>A linked hash map has two parameters that affect its performance:
|
||||
* <i>initial capacity</i> and <i>load factor</i>. They are defined precisely
|
||||
* as for <tt>HashMap</tt>. Note, however, that the penalty for choosing an
|
||||
* as for {@code HashMap}. Note, however, that the penalty for choosing an
|
||||
* excessively high value for initial capacity is less severe for this class
|
||||
* than for <tt>HashMap</tt>, as iteration times for this class are unaffected
|
||||
* than for {@code HashMap}, as iteration times for this class are unaffected
|
||||
* by capacity.
|
||||
*
|
||||
* <p><strong>Note that this implementation is not synchronized.</strong>
|
||||
@ -114,14 +114,14 @@ import java.io.IOException;
|
||||
* iteration order. In insertion-ordered linked hash maps, merely changing
|
||||
* the value associated with a key that is already contained in the map is not
|
||||
* a structural modification. <strong>In access-ordered linked hash maps,
|
||||
* merely querying the map with <tt>get</tt> is a structural modification.
|
||||
* merely querying the map with {@code get} is a structural modification.
|
||||
* </strong>)
|
||||
*
|
||||
* <p>The iterators returned by the <tt>iterator</tt> method of the collections
|
||||
* <p>The iterators returned by the {@code iterator} method of the collections
|
||||
* returned by all of this class's collection view methods are
|
||||
* <em>fail-fast</em>: if the map is structurally modified at any time after
|
||||
* the iterator is created, in any way except through the iterator's own
|
||||
* <tt>remove</tt> method, the iterator will throw a {@link
|
||||
* {@code remove} method, the iterator will throw a {@link
|
||||
* ConcurrentModificationException}. Thus, in the face of concurrent
|
||||
* modification, the iterator fails quickly and cleanly, rather than risking
|
||||
* arbitrary, non-deterministic behavior at an undetermined time in the future.
|
||||
@ -129,7 +129,7 @@ import java.io.IOException;
|
||||
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
|
||||
* as it is, generally speaking, impossible to make any hard guarantees in the
|
||||
* presence of unsynchronized concurrent modification. Fail-fast iterators
|
||||
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
|
||||
* throw {@code ConcurrentModificationException} on a best-effort basis.
|
||||
* Therefore, it would be wrong to write a program that depended on this
|
||||
* exception for its correctness: <i>the fail-fast behavior of iterators
|
||||
* should be used only to detect bugs.</i>
|
||||
@ -209,8 +209,8 @@ public class LinkedHashMap<K,V>
|
||||
transient LinkedHashMap.Entry<K,V> tail;
|
||||
|
||||
/**
|
||||
* The iteration ordering method for this linked hash map: <tt>true</tt>
|
||||
* for access-order, <tt>false</tt> for insertion-order.
|
||||
* The iteration ordering method for this linked hash map: {@code true}
|
||||
* for access-order, {@code false} for insertion-order.
|
||||
*
|
||||
* @serial
|
||||
*/
|
||||
@ -335,7 +335,7 @@ public class LinkedHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance
|
||||
* Constructs an empty insertion-ordered {@code LinkedHashMap} instance
|
||||
* with the specified initial capacity and load factor.
|
||||
*
|
||||
* @param initialCapacity the initial capacity
|
||||
@ -349,7 +349,7 @@ public class LinkedHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance
|
||||
* Constructs an empty insertion-ordered {@code LinkedHashMap} instance
|
||||
* with the specified initial capacity and a default load factor (0.75).
|
||||
*
|
||||
* @param initialCapacity the initial capacity
|
||||
@ -361,7 +361,7 @@ public class LinkedHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an empty insertion-ordered <tt>LinkedHashMap</tt> instance
|
||||
* Constructs an empty insertion-ordered {@code LinkedHashMap} instance
|
||||
* with the default initial capacity (16) and load factor (0.75).
|
||||
*/
|
||||
public LinkedHashMap() {
|
||||
@ -370,8 +370,8 @@ public class LinkedHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an insertion-ordered <tt>LinkedHashMap</tt> instance with
|
||||
* the same mappings as the specified map. The <tt>LinkedHashMap</tt>
|
||||
* Constructs an insertion-ordered {@code LinkedHashMap} instance with
|
||||
* the same mappings as the specified map. The {@code LinkedHashMap}
|
||||
* instance is created with a default load factor (0.75) and an initial
|
||||
* capacity sufficient to hold the mappings in the specified map.
|
||||
*
|
||||
@ -385,13 +385,13 @@ public class LinkedHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an empty <tt>LinkedHashMap</tt> instance with the
|
||||
* Constructs an empty {@code LinkedHashMap} instance with the
|
||||
* specified initial capacity, load factor and ordering mode.
|
||||
*
|
||||
* @param initialCapacity the initial capacity
|
||||
* @param loadFactor the load factor
|
||||
* @param accessOrder the ordering mode - <tt>true</tt> for
|
||||
* access-order, <tt>false</tt> for insertion-order
|
||||
* @param accessOrder the ordering mode - {@code true} for
|
||||
* access-order, {@code false} for insertion-order
|
||||
* @throws IllegalArgumentException if the initial capacity is negative
|
||||
* or the load factor is nonpositive
|
||||
*/
|
||||
@ -404,11 +404,11 @@ public class LinkedHashMap<K,V>
|
||||
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map maps one or more keys to the
|
||||
* Returns {@code true} if this map maps one or more keys to the
|
||||
* specified value.
|
||||
*
|
||||
* @param value value whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map maps one or more keys to the
|
||||
* @return {@code true} if this map maps one or more keys to the
|
||||
* specified value
|
||||
*/
|
||||
public boolean containsValue(Object value) {
|
||||
@ -465,8 +465,8 @@ public class LinkedHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map should remove its eldest entry.
|
||||
* This method is invoked by <tt>put</tt> and <tt>putAll</tt> after
|
||||
* Returns {@code true} if this map should remove its eldest entry.
|
||||
* This method is invoked by {@code put} and {@code putAll} after
|
||||
* inserting a new entry into the map. It provides the implementor
|
||||
* with the opportunity to remove the eldest entry each time a new one
|
||||
* is added. This is useful if the map represents a cache: it allows
|
||||
@ -487,23 +487,23 @@ public class LinkedHashMap<K,V>
|
||||
* instead allowing the map to modify itself as directed by its
|
||||
* return value. It <i>is</i> permitted for this method to modify
|
||||
* the map directly, but if it does so, it <i>must</i> return
|
||||
* <tt>false</tt> (indicating that the map should not attempt any
|
||||
* further modification). The effects of returning <tt>true</tt>
|
||||
* {@code false} (indicating that the map should not attempt any
|
||||
* further modification). The effects of returning {@code true}
|
||||
* after modifying the map from within this method are unspecified.
|
||||
*
|
||||
* <p>This implementation merely returns <tt>false</tt> (so that this
|
||||
* <p>This implementation merely returns {@code false} (so that this
|
||||
* map acts like a normal map - the eldest element is never removed).
|
||||
*
|
||||
* @param eldest The least recently inserted entry in the map, or if
|
||||
* this is an access-ordered map, the least recently accessed
|
||||
* entry. This is the entry that will be removed it this
|
||||
* method returns <tt>true</tt>. If the map was empty prior
|
||||
* to the <tt>put</tt> or <tt>putAll</tt> invocation resulting
|
||||
* method returns {@code true}. If the map was empty prior
|
||||
* to the {@code put} or {@code putAll} invocation resulting
|
||||
* in this invocation, this will be the entry that was just
|
||||
* inserted; in other words, if the map contains a single
|
||||
* entry, the eldest entry is also the newest.
|
||||
* @return <tt>true</tt> if the eldest entry should be removed
|
||||
* from the map; <tt>false</tt> if it should be retained.
|
||||
* @return {@code true} if the eldest entry should be removed
|
||||
* from the map; {@code false} if it should be retained.
|
||||
*/
|
||||
protected boolean removeEldestEntry(Map.Entry<K,V> eldest) {
|
||||
return false;
|
||||
@ -514,12 +514,12 @@ public class LinkedHashMap<K,V>
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation), the results of
|
||||
* the iterator's own {@code remove} operation), the results of
|
||||
* the iteration are undefined. The set supports element removal,
|
||||
* which removes the corresponding mapping from the map, via the
|
||||
* <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
|
||||
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
|
||||
* operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
|
||||
* {@code Iterator.remove}, {@code Set.remove},
|
||||
* {@code removeAll}, {@code retainAll}, and {@code clear}
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
* Its {@link Spliterator} typically provides faster sequential
|
||||
* performance but much poorer parallel performance than that of
|
||||
@ -563,13 +563,13 @@ public class LinkedHashMap<K,V>
|
||||
* The collection is backed by the map, so changes to the map are
|
||||
* reflected in the collection, and vice-versa. If the map is
|
||||
* modified while an iteration over the collection is in progress
|
||||
* (except through the iterator's own <tt>remove</tt> operation),
|
||||
* (except through the iterator's own {@code remove} operation),
|
||||
* the results of the iteration are undefined. The collection
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Collection.remove</tt>, <tt>removeAll</tt>,
|
||||
* <tt>retainAll</tt> and <tt>clear</tt> operations. It does not
|
||||
* support the <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Collection.remove}, {@code removeAll},
|
||||
* {@code retainAll} and {@code clear} operations. It does not
|
||||
* support the {@code add} or {@code addAll} operations.
|
||||
* Its {@link Spliterator} typically provides faster sequential
|
||||
* performance but much poorer parallel performance than that of
|
||||
* {@code HashMap}.
|
||||
@ -608,14 +608,14 @@ public class LinkedHashMap<K,V>
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation, or through the
|
||||
* <tt>setValue</tt> operation on a map entry returned by the
|
||||
* the iterator's own {@code remove} operation, or through the
|
||||
* {@code setValue} operation on a map entry returned by the
|
||||
* iterator) the results of the iteration are undefined. The set
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
|
||||
* <tt>clear</tt> operations. It does not support the
|
||||
* <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Set.remove}, {@code removeAll}, {@code retainAll} and
|
||||
* {@code clear} operations. It does not support the
|
||||
* {@code add} or {@code addAll} operations.
|
||||
* Its {@link Spliterator} typically provides faster sequential
|
||||
* performance but much poorer parallel performance than that of
|
||||
* {@code HashMap}.
|
||||
|
||||
@ -26,15 +26,15 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* <p>Hash table and linked list implementation of the <tt>Set</tt> interface,
|
||||
* <p>Hash table and linked list implementation of the {@code Set} interface,
|
||||
* with predictable iteration order. This implementation differs from
|
||||
* <tt>HashSet</tt> in that it maintains a doubly-linked list running through
|
||||
* {@code HashSet} in that it maintains a doubly-linked list running through
|
||||
* all of its entries. This linked list defines the iteration ordering,
|
||||
* which is the order in which elements were inserted into the set
|
||||
* (<i>insertion-order</i>). Note that insertion order is <i>not</i> affected
|
||||
* if an element is <i>re-inserted</i> into the set. (An element <tt>e</tt>
|
||||
* is reinserted into a set <tt>s</tt> if <tt>s.add(e)</tt> is invoked when
|
||||
* <tt>s.contains(e)</tt> would return <tt>true</tt> immediately prior to
|
||||
* if an element is <i>re-inserted</i> into the set. (An element {@code e}
|
||||
* is reinserted into a set {@code s} if {@code s.add(e)} is invoked when
|
||||
* {@code s.contains(e)} would return {@code true} immediately prior to
|
||||
* the invocation.)
|
||||
*
|
||||
* <p>This implementation spares its clients from the unspecified, generally
|
||||
@ -53,22 +53,22 @@ package java.util;
|
||||
* the copy. (Clients generally appreciate having things returned in the same
|
||||
* order they were presented.)
|
||||
*
|
||||
* <p>This class provides all of the optional <tt>Set</tt> operations, and
|
||||
* permits null elements. Like <tt>HashSet</tt>, it provides constant-time
|
||||
* performance for the basic operations (<tt>add</tt>, <tt>contains</tt> and
|
||||
* <tt>remove</tt>), assuming the hash function disperses elements
|
||||
* <p>This class provides all of the optional {@code Set} operations, and
|
||||
* permits null elements. Like {@code HashSet}, it provides constant-time
|
||||
* performance for the basic operations ({@code add}, {@code contains} and
|
||||
* {@code remove}), assuming the hash function disperses elements
|
||||
* properly among the buckets. Performance is likely to be just slightly
|
||||
* below that of <tt>HashSet</tt>, due to the added expense of maintaining the
|
||||
* linked list, with one exception: Iteration over a <tt>LinkedHashSet</tt>
|
||||
* below that of {@code HashSet}, due to the added expense of maintaining the
|
||||
* linked list, with one exception: Iteration over a {@code LinkedHashSet}
|
||||
* requires time proportional to the <i>size</i> of the set, regardless of
|
||||
* its capacity. Iteration over a <tt>HashSet</tt> is likely to be more
|
||||
* its capacity. Iteration over a {@code HashSet} is likely to be more
|
||||
* expensive, requiring time proportional to its <i>capacity</i>.
|
||||
*
|
||||
* <p>A linked hash set has two parameters that affect its performance:
|
||||
* <i>initial capacity</i> and <i>load factor</i>. They are defined precisely
|
||||
* as for <tt>HashSet</tt>. Note, however, that the penalty for choosing an
|
||||
* as for {@code HashSet}. Note, however, that the penalty for choosing an
|
||||
* excessively high value for initial capacity is less severe for this class
|
||||
* than for <tt>HashSet</tt>, as iteration times for this class are unaffected
|
||||
* than for {@code HashSet}, as iteration times for this class are unaffected
|
||||
* by capacity.
|
||||
*
|
||||
* <p><strong>Note that this implementation is not synchronized.</strong>
|
||||
@ -83,9 +83,9 @@ package java.util;
|
||||
* unsynchronized access to the set: <pre>
|
||||
* Set s = Collections.synchronizedSet(new LinkedHashSet(...));</pre>
|
||||
*
|
||||
* <p>The iterators returned by this class's <tt>iterator</tt> method are
|
||||
* <p>The iterators returned by this class's {@code iterator} method are
|
||||
* <em>fail-fast</em>: if the set is modified at any time after the iterator
|
||||
* is created, in any way except through the iterator's own <tt>remove</tt>
|
||||
* is created, in any way except through the iterator's own {@code remove}
|
||||
* method, the iterator will throw a {@link ConcurrentModificationException}.
|
||||
* Thus, in the face of concurrent modification, the iterator fails quickly
|
||||
* and cleanly, rather than risking arbitrary, non-deterministic behavior at
|
||||
@ -94,7 +94,7 @@ package java.util;
|
||||
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
|
||||
* as it is, generally speaking, impossible to make any hard guarantees in the
|
||||
* presence of unsynchronized concurrent modification. Fail-fast iterators
|
||||
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
|
||||
* throw {@code ConcurrentModificationException} on a best-effort basis.
|
||||
* Therefore, it would be wrong to write a program that depended on this
|
||||
* exception for its correctness: <i>the fail-fast behavior of iterators
|
||||
* should be used only to detect bugs.</i>
|
||||
|
||||
@ -312,7 +312,7 @@ public class LinkedList<E>
|
||||
* Returns {@code true} if this list contains the specified element.
|
||||
* More formally, returns {@code true} if and only if this list contains
|
||||
* at least one element {@code e} such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>.
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param o element whose presence in this list is to be tested
|
||||
* @return {@code true} if this list contains the specified element
|
||||
@ -348,7 +348,7 @@ public class LinkedList<E>
|
||||
* if it is present. If this list does not contain the element, it is
|
||||
* unchanged. More formally, removes the element with the lowest index
|
||||
* {@code i} such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>
|
||||
* {@code Objects.equals(o, get(i))}
|
||||
* (if such an element exists). Returns {@code true} if this list
|
||||
* contained the specified element (or equivalently, if this list
|
||||
* changed as a result of the call).
|
||||
@ -589,7 +589,7 @@ public class LinkedList<E>
|
||||
* Returns the index of the first occurrence of the specified element
|
||||
* in this list, or -1 if this list does not contain the element.
|
||||
* More formally, returns the lowest index {@code i} such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
|
||||
* {@code Objects.equals(o, get(i))},
|
||||
* or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for
|
||||
@ -618,7 +618,7 @@ public class LinkedList<E>
|
||||
* Returns the index of the last occurrence of the specified element
|
||||
* in this list, or -1 if this list does not contain the element.
|
||||
* More formally, returns the highest index {@code i} such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
|
||||
* {@code Objects.equals(o, get(i))},
|
||||
* or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for
|
||||
|
||||
@ -34,50 +34,50 @@ import java.util.function.UnaryOperator;
|
||||
* the list), and search for elements in the list.<p>
|
||||
*
|
||||
* Unlike sets, lists typically allow duplicate elements. More formally,
|
||||
* lists typically allow pairs of elements <tt>e1</tt> and <tt>e2</tt>
|
||||
* such that <tt>e1.equals(e2)</tt>, and they typically allow multiple
|
||||
* lists typically allow pairs of elements {@code e1} and {@code e2}
|
||||
* such that {@code e1.equals(e2)}, and they typically allow multiple
|
||||
* null elements if they allow null elements at all. It is not inconceivable
|
||||
* that someone might wish to implement a list that prohibits duplicates, by
|
||||
* throwing runtime exceptions when the user attempts to insert them, but we
|
||||
* expect this usage to be rare.<p>
|
||||
*
|
||||
* The <tt>List</tt> interface places additional stipulations, beyond those
|
||||
* specified in the <tt>Collection</tt> interface, on the contracts of the
|
||||
* <tt>iterator</tt>, <tt>add</tt>, <tt>remove</tt>, <tt>equals</tt>, and
|
||||
* <tt>hashCode</tt> methods. Declarations for other inherited methods are
|
||||
* The {@code List} interface places additional stipulations, beyond those
|
||||
* specified in the {@code Collection} interface, on the contracts of the
|
||||
* {@code iterator}, {@code add}, {@code remove}, {@code equals}, and
|
||||
* {@code hashCode} methods. Declarations for other inherited methods are
|
||||
* also included here for convenience.<p>
|
||||
*
|
||||
* The <tt>List</tt> interface provides four methods for positional (indexed)
|
||||
* The {@code List} interface provides four methods for positional (indexed)
|
||||
* access to list elements. Lists (like Java arrays) are zero based. Note
|
||||
* that these operations may execute in time proportional to the index value
|
||||
* for some implementations (the <tt>LinkedList</tt> class, for
|
||||
* for some implementations (the {@code LinkedList} class, for
|
||||
* example). Thus, iterating over the elements in a list is typically
|
||||
* preferable to indexing through it if the caller does not know the
|
||||
* implementation.<p>
|
||||
*
|
||||
* The <tt>List</tt> interface provides a special iterator, called a
|
||||
* <tt>ListIterator</tt>, that allows element insertion and replacement, and
|
||||
* The {@code List} interface provides a special iterator, called a
|
||||
* {@code ListIterator}, that allows element insertion and replacement, and
|
||||
* bidirectional access in addition to the normal operations that the
|
||||
* <tt>Iterator</tt> interface provides. A method is provided to obtain a
|
||||
* {@code Iterator} interface provides. A method is provided to obtain a
|
||||
* list iterator that starts at a specified position in the list.<p>
|
||||
*
|
||||
* The <tt>List</tt> interface provides two methods to search for a specified
|
||||
* The {@code List} interface provides two methods to search for a specified
|
||||
* object. From a performance standpoint, these methods should be used with
|
||||
* caution. In many implementations they will perform costly linear
|
||||
* searches.<p>
|
||||
*
|
||||
* The <tt>List</tt> interface provides two methods to efficiently insert and
|
||||
* The {@code List} interface provides two methods to efficiently insert and
|
||||
* remove multiple elements at an arbitrary point in the list.<p>
|
||||
*
|
||||
* Note: While it is permissible for lists to contain themselves as elements,
|
||||
* extreme caution is advised: the <tt>equals</tt> and <tt>hashCode</tt>
|
||||
* extreme caution is advised: the {@code equals} and {@code hashCode}
|
||||
* methods are no longer well defined on such a list.
|
||||
*
|
||||
* <p>Some list implementations have restrictions on the elements that
|
||||
* they may contain. For example, some implementations prohibit null elements,
|
||||
* and some have restrictions on the types of their elements. Attempting to
|
||||
* add an ineligible element throws an unchecked exception, typically
|
||||
* <tt>NullPointerException</tt> or <tt>ClassCastException</tt>. Attempting
|
||||
* {@code NullPointerException} or {@code ClassCastException}. Attempting
|
||||
* to query the presence of an ineligible element may throw an exception,
|
||||
* or it may simply return false; some implementations will exhibit the former
|
||||
* behavior and some will exhibit the latter. More generally, attempting an
|
||||
@ -113,28 +113,28 @@ public interface List<E> extends Collection<E> {
|
||||
|
||||
/**
|
||||
* Returns the number of elements in this list. If this list contains
|
||||
* more than <tt>Integer.MAX_VALUE</tt> elements, returns
|
||||
* <tt>Integer.MAX_VALUE</tt>.
|
||||
* more than {@code Integer.MAX_VALUE} elements, returns
|
||||
* {@code Integer.MAX_VALUE}.
|
||||
*
|
||||
* @return the number of elements in this list
|
||||
*/
|
||||
int size();
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this list contains no elements.
|
||||
* Returns {@code true} if this list contains no elements.
|
||||
*
|
||||
* @return <tt>true</tt> if this list contains no elements
|
||||
* @return {@code true} if this list contains no elements
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this list contains the specified element.
|
||||
* More formally, returns <tt>true</tt> if and only if this list contains
|
||||
* at least one element <tt>e</tt> such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>.
|
||||
* Returns {@code true} if this list contains the specified element.
|
||||
* More formally, returns {@code true} if and only if this list contains
|
||||
* at least one element {@code e} such that
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param o element whose presence in this list is to be tested
|
||||
* @return <tt>true</tt> if this list contains the specified element
|
||||
* @return {@code true} if this list contains the specified element
|
||||
* @throws ClassCastException if the type of the specified element
|
||||
* is incompatible with this list
|
||||
* (<a href="Collection.html#optional-restrictions">optional</a>)
|
||||
@ -179,7 +179,7 @@ public interface List<E> extends Collection<E> {
|
||||
*
|
||||
* <p>If the list fits in the specified array with room to spare (i.e.,
|
||||
* the array has more elements than the list), the element in the array
|
||||
* immediately following the end of the list is set to <tt>null</tt>.
|
||||
* immediately following the end of the list is set to {@code null}.
|
||||
* (This is useful in determining the length of the list <i>only</i> if
|
||||
* the caller knows that the list does not contain any null elements.)
|
||||
*
|
||||
@ -188,16 +188,16 @@ public interface List<E> extends Collection<E> {
|
||||
* precise control over the runtime type of the output array, and may,
|
||||
* under certain circumstances, be used to save allocation costs.
|
||||
*
|
||||
* <p>Suppose <tt>x</tt> is a list known to contain only strings.
|
||||
* <p>Suppose {@code x} is a list known to contain only strings.
|
||||
* The following code can be used to dump the list into a newly
|
||||
* allocated array of <tt>String</tt>:
|
||||
* allocated array of {@code String}:
|
||||
*
|
||||
* <pre>{@code
|
||||
* String[] y = x.toArray(new String[0]);
|
||||
* }</pre>
|
||||
*
|
||||
* Note that <tt>toArray(new Object[0])</tt> is identical in function to
|
||||
* <tt>toArray()</tt>.
|
||||
* Note that {@code toArray(new Object[0])} is identical in function to
|
||||
* {@code toArray()}.
|
||||
*
|
||||
* @param a the array into which the elements of this list are to
|
||||
* be stored, if it is big enough; otherwise, a new array of the
|
||||
@ -225,8 +225,8 @@ public interface List<E> extends Collection<E> {
|
||||
* on what elements may be added.
|
||||
*
|
||||
* @param e element to be appended to this list
|
||||
* @return <tt>true</tt> (as specified by {@link Collection#add})
|
||||
* @throws UnsupportedOperationException if the <tt>add</tt> operation
|
||||
* @return {@code true} (as specified by {@link Collection#add})
|
||||
* @throws UnsupportedOperationException if the {@code add} operation
|
||||
* is not supported by this list
|
||||
* @throws ClassCastException if the class of the specified element
|
||||
* prevents it from being added to this list
|
||||
@ -241,21 +241,21 @@ public interface List<E> extends Collection<E> {
|
||||
* Removes the first occurrence of the specified element from this list,
|
||||
* if it is present (optional operation). If this list does not contain
|
||||
* the element, it is unchanged. More formally, removes the element with
|
||||
* the lowest index <tt>i</tt> such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>
|
||||
* (if such an element exists). Returns <tt>true</tt> if this list
|
||||
* the lowest index {@code i} such that
|
||||
* {@code Objects.equals(o, get(i))}
|
||||
* (if such an element exists). Returns {@code true} if this list
|
||||
* contained the specified element (or equivalently, if this list changed
|
||||
* as a result of the call).
|
||||
*
|
||||
* @param o element to be removed from this list, if present
|
||||
* @return <tt>true</tt> if this list contained the specified element
|
||||
* @return {@code true} if this list contained the specified element
|
||||
* @throws ClassCastException if the type of the specified element
|
||||
* is incompatible with this list
|
||||
* (<a href="Collection.html#optional-restrictions">optional</a>)
|
||||
* @throws NullPointerException if the specified element is null and this
|
||||
* list does not permit null elements
|
||||
* (<a href="Collection.html#optional-restrictions">optional</a>)
|
||||
* @throws UnsupportedOperationException if the <tt>remove</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code remove} operation
|
||||
* is not supported by this list
|
||||
*/
|
||||
boolean remove(Object o);
|
||||
@ -264,11 +264,11 @@ public interface List<E> extends Collection<E> {
|
||||
// Bulk Modification Operations
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this list contains all of the elements of the
|
||||
* Returns {@code true} if this list contains all of the elements of the
|
||||
* specified collection.
|
||||
*
|
||||
* @param c collection to be checked for containment in this list
|
||||
* @return <tt>true</tt> if this list contains all of the elements of the
|
||||
* @return {@code true} if this list contains all of the elements of the
|
||||
* specified collection
|
||||
* @throws ClassCastException if the types of one or more elements
|
||||
* in the specified collection are incompatible with this
|
||||
@ -292,8 +292,8 @@ public interface List<E> extends Collection<E> {
|
||||
* specified collection is this list, and it's nonempty.)
|
||||
*
|
||||
* @param c collection containing elements to be added to this list
|
||||
* @return <tt>true</tt> if this list changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>addAll</tt> operation
|
||||
* @return {@code true} if this list changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code addAll} operation
|
||||
* is not supported by this list
|
||||
* @throws ClassCastException if the class of an element of the specified
|
||||
* collection prevents it from being added to this list
|
||||
@ -320,8 +320,8 @@ public interface List<E> extends Collection<E> {
|
||||
* @param index index at which to insert the first element from the
|
||||
* specified collection
|
||||
* @param c collection containing elements to be added to this list
|
||||
* @return <tt>true</tt> if this list changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>addAll</tt> operation
|
||||
* @return {@code true} if this list changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code addAll} operation
|
||||
* is not supported by this list
|
||||
* @throws ClassCastException if the class of an element of the specified
|
||||
* collection prevents it from being added to this list
|
||||
@ -331,7 +331,7 @@ public interface List<E> extends Collection<E> {
|
||||
* @throws IllegalArgumentException if some property of an element of the
|
||||
* specified collection prevents it from being added to this list
|
||||
* @throws IndexOutOfBoundsException if the index is out of range
|
||||
* (<tt>index < 0 || index > size()</tt>)
|
||||
* ({@code index < 0 || index > size()})
|
||||
*/
|
||||
boolean addAll(int index, Collection<? extends E> c);
|
||||
|
||||
@ -340,8 +340,8 @@ public interface List<E> extends Collection<E> {
|
||||
* specified collection (optional operation).
|
||||
*
|
||||
* @param c collection containing elements to be removed from this list
|
||||
* @return <tt>true</tt> if this list changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>removeAll</tt> operation
|
||||
* @return {@code true} if this list changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code removeAll} operation
|
||||
* is not supported by this list
|
||||
* @throws ClassCastException if the class of an element of this list
|
||||
* is incompatible with the specified collection
|
||||
@ -362,8 +362,8 @@ public interface List<E> extends Collection<E> {
|
||||
* specified collection.
|
||||
*
|
||||
* @param c collection containing elements to be retained in this list
|
||||
* @return <tt>true</tt> if this list changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>retainAll</tt> operation
|
||||
* @return {@code true} if this list changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code retainAll} operation
|
||||
* is not supported by this list
|
||||
* @throws ClassCastException if the class of an element of this list
|
||||
* is incompatible with the specified collection
|
||||
@ -487,7 +487,7 @@ public interface List<E> extends Collection<E> {
|
||||
* Removes all of the elements from this list (optional operation).
|
||||
* The list will be empty after this call returns.
|
||||
*
|
||||
* @throws UnsupportedOperationException if the <tt>clear</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code clear} operation
|
||||
* is not supported by this list
|
||||
*/
|
||||
void clear();
|
||||
@ -497,17 +497,17 @@ public interface List<E> extends Collection<E> {
|
||||
|
||||
/**
|
||||
* Compares the specified object with this list for equality. Returns
|
||||
* <tt>true</tt> if and only if the specified object is also a list, both
|
||||
* {@code true} if and only if the specified object is also a list, both
|
||||
* lists have the same size, and all corresponding pairs of elements in
|
||||
* the two lists are <i>equal</i>. (Two elements <tt>e1</tt> and
|
||||
* <tt>e2</tt> are <i>equal</i> if <tt>(e1==null ? e2==null :
|
||||
* e1.equals(e2))</tt>.) In other words, two lists are defined to be
|
||||
* the two lists are <i>equal</i>. (Two elements {@code e1} and
|
||||
* {@code e2} are <i>equal</i> if {@code Objects.equals(e1, e2)}.)
|
||||
* In other words, two lists are defined to be
|
||||
* equal if they contain the same elements in the same order. This
|
||||
* definition ensures that the equals method works properly across
|
||||
* different implementations of the <tt>List</tt> interface.
|
||||
* different implementations of the {@code List} interface.
|
||||
*
|
||||
* @param o the object to be compared for equality with this list
|
||||
* @return <tt>true</tt> if the specified object is equal to this list
|
||||
* @return {@code true} if the specified object is equal to this list
|
||||
*/
|
||||
boolean equals(Object o);
|
||||
|
||||
@ -519,9 +519,9 @@ public interface List<E> extends Collection<E> {
|
||||
* for (E e : list)
|
||||
* hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
|
||||
* }</pre>
|
||||
* This ensures that <tt>list1.equals(list2)</tt> implies that
|
||||
* <tt>list1.hashCode()==list2.hashCode()</tt> for any two lists,
|
||||
* <tt>list1</tt> and <tt>list2</tt>, as required by the general
|
||||
* This ensures that {@code list1.equals(list2)} implies that
|
||||
* {@code list1.hashCode()==list2.hashCode()} for any two lists,
|
||||
* {@code list1} and {@code list2}, as required by the general
|
||||
* contract of {@link Object#hashCode}.
|
||||
*
|
||||
* @return the hash code value for this list
|
||||
@ -539,7 +539,7 @@ public interface List<E> extends Collection<E> {
|
||||
* @param index index of the element to return
|
||||
* @return the element at the specified position in this list
|
||||
* @throws IndexOutOfBoundsException if the index is out of range
|
||||
* (<tt>index < 0 || index >= size()</tt>)
|
||||
* ({@code index < 0 || index >= size()})
|
||||
*/
|
||||
E get(int index);
|
||||
|
||||
@ -550,7 +550,7 @@ public interface List<E> extends Collection<E> {
|
||||
* @param index index of the element to replace
|
||||
* @param element element to be stored at the specified position
|
||||
* @return the element previously at the specified position
|
||||
* @throws UnsupportedOperationException if the <tt>set</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code set} operation
|
||||
* is not supported by this list
|
||||
* @throws ClassCastException if the class of the specified element
|
||||
* prevents it from being added to this list
|
||||
@ -559,7 +559,7 @@ public interface List<E> extends Collection<E> {
|
||||
* @throws IllegalArgumentException if some property of the specified
|
||||
* element prevents it from being added to this list
|
||||
* @throws IndexOutOfBoundsException if the index is out of range
|
||||
* (<tt>index < 0 || index >= size()</tt>)
|
||||
* ({@code index < 0 || index >= size()})
|
||||
*/
|
||||
E set(int index, E element);
|
||||
|
||||
@ -571,7 +571,7 @@ public interface List<E> extends Collection<E> {
|
||||
*
|
||||
* @param index index at which the specified element is to be inserted
|
||||
* @param element element to be inserted
|
||||
* @throws UnsupportedOperationException if the <tt>add</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code add} operation
|
||||
* is not supported by this list
|
||||
* @throws ClassCastException if the class of the specified element
|
||||
* prevents it from being added to this list
|
||||
@ -580,7 +580,7 @@ public interface List<E> extends Collection<E> {
|
||||
* @throws IllegalArgumentException if some property of the specified
|
||||
* element prevents it from being added to this list
|
||||
* @throws IndexOutOfBoundsException if the index is out of range
|
||||
* (<tt>index < 0 || index > size()</tt>)
|
||||
* ({@code index < 0 || index > size()})
|
||||
*/
|
||||
void add(int index, E element);
|
||||
|
||||
@ -592,10 +592,10 @@ public interface List<E> extends Collection<E> {
|
||||
*
|
||||
* @param index the index of the element to be removed
|
||||
* @return the element previously at the specified position
|
||||
* @throws UnsupportedOperationException if the <tt>remove</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code remove} operation
|
||||
* is not supported by this list
|
||||
* @throws IndexOutOfBoundsException if the index is out of range
|
||||
* (<tt>index < 0 || index >= size()</tt>)
|
||||
* ({@code index < 0 || index >= size()})
|
||||
*/
|
||||
E remove(int index);
|
||||
|
||||
@ -605,8 +605,8 @@ public interface List<E> extends Collection<E> {
|
||||
/**
|
||||
* Returns the index of the first occurrence of the specified element
|
||||
* in this list, or -1 if this list does not contain the element.
|
||||
* More formally, returns the lowest index <tt>i</tt> such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
|
||||
* More formally, returns the lowest index {@code i} such that
|
||||
* {@code Objects.equals(o, get(i))},
|
||||
* or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for
|
||||
@ -624,8 +624,8 @@ public interface List<E> extends Collection<E> {
|
||||
/**
|
||||
* Returns the index of the last occurrence of the specified element
|
||||
* in this list, or -1 if this list does not contain the element.
|
||||
* More formally, returns the highest index <tt>i</tt> such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
|
||||
* More formally, returns the highest index {@code i} such that
|
||||
* {@code Objects.equals(o, get(i))},
|
||||
* or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for
|
||||
@ -673,8 +673,8 @@ public interface List<E> extends Collection<E> {
|
||||
|
||||
/**
|
||||
* Returns a view of the portion of this list between the specified
|
||||
* <tt>fromIndex</tt>, inclusive, and <tt>toIndex</tt>, exclusive. (If
|
||||
* <tt>fromIndex</tt> and <tt>toIndex</tt> are equal, the returned list is
|
||||
* {@code fromIndex}, inclusive, and {@code toIndex}, exclusive. (If
|
||||
* {@code fromIndex} and {@code toIndex} are equal, the returned list is
|
||||
* empty.) The returned list is backed by this list, so non-structural
|
||||
* changes in the returned list are reflected in this list, and vice-versa.
|
||||
* The returned list supports all of the optional list operations supported
|
||||
@ -688,9 +688,9 @@ public interface List<E> extends Collection<E> {
|
||||
* <pre>{@code
|
||||
* list.subList(from, to).clear();
|
||||
* }</pre>
|
||||
* Similar idioms may be constructed for <tt>indexOf</tt> and
|
||||
* <tt>lastIndexOf</tt>, and all of the algorithms in the
|
||||
* <tt>Collections</tt> class can be applied to a subList.<p>
|
||||
* Similar idioms may be constructed for {@code indexOf} and
|
||||
* {@code lastIndexOf}, and all of the algorithms in the
|
||||
* {@code Collections} class can be applied to a subList.<p>
|
||||
*
|
||||
* The semantics of the list returned by this method become undefined if
|
||||
* the backing list (i.e., this list) is <i>structurally modified</i> in
|
||||
@ -702,8 +702,8 @@ public interface List<E> extends Collection<E> {
|
||||
* @param toIndex high endpoint (exclusive) of the subList
|
||||
* @return a view of the specified range within this list
|
||||
* @throws IndexOutOfBoundsException for an illegal endpoint index value
|
||||
* (<tt>fromIndex < 0 || toIndex > size ||
|
||||
* fromIndex > toIndex</tt>)
|
||||
* ({@code fromIndex < 0 || toIndex > size ||
|
||||
* fromIndex > toIndex})
|
||||
*/
|
||||
List<E> subList(int fromIndex, int toIndex);
|
||||
|
||||
|
||||
@ -413,24 +413,24 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
|
||||
*
|
||||
* <p>For compatibility reasons, two
|
||||
* non-conforming locales are treated as special cases. These are
|
||||
* <b><tt>ja_JP_JP</tt></b> and <b><tt>th_TH_TH</tt></b>. These are ill-formed
|
||||
* <b>{@code ja_JP_JP}</b> and <b>{@code th_TH_TH}</b>. These are ill-formed
|
||||
* in BCP 47 since the variants are too short. To ease migration to BCP 47,
|
||||
* these are treated specially during construction. These two cases (and only
|
||||
* these) cause a constructor to generate an extension, all other values behave
|
||||
* exactly as they did prior to Java 7.
|
||||
*
|
||||
* <p>Java has used <tt>ja_JP_JP</tt> to represent Japanese as used in
|
||||
* <p>Java has used {@code ja_JP_JP} to represent Japanese as used in
|
||||
* Japan together with the Japanese Imperial calendar. This is now
|
||||
* representable using a Unicode locale extension, by specifying the
|
||||
* Unicode locale key <tt>ca</tt> (for "calendar") and type
|
||||
* <tt>japanese</tt>. When the Locale constructor is called with the
|
||||
* Unicode locale key {@code ca} (for "calendar") and type
|
||||
* {@code japanese}. When the Locale constructor is called with the
|
||||
* arguments "ja", "JP", "JP", the extension "u-ca-japanese" is
|
||||
* automatically added.
|
||||
*
|
||||
* <p>Java has used <tt>th_TH_TH</tt> to represent Thai as used in
|
||||
* <p>Java has used {@code th_TH_TH} to represent Thai as used in
|
||||
* Thailand together with Thai digits. This is also now representable using
|
||||
* a Unicode locale extension, by specifying the Unicode locale key
|
||||
* <tt>nu</tt> (for "number") and value <tt>thai</tt>. When the Locale
|
||||
* {@code nu} (for "number") and value {@code thai}. When the Locale
|
||||
* constructor is called with the arguments "th", "TH", "TH", the
|
||||
* extension "u-nu-thai" is automatically added.
|
||||
*
|
||||
@ -446,9 +446,9 @@ import sun.util.locale.provider.ResourceBundleBasedAdapter;
|
||||
* <h5>Legacy language codes</h5>
|
||||
*
|
||||
* <p>Locale's constructor has always converted three language codes to
|
||||
* their earlier, obsoleted forms: <tt>he</tt> maps to <tt>iw</tt>,
|
||||
* <tt>yi</tt> maps to <tt>ji</tt>, and <tt>id</tt> maps to
|
||||
* <tt>in</tt>. This continues to be the case, in order to not break
|
||||
* their earlier, obsoleted forms: {@code he} maps to {@code iw},
|
||||
* {@code yi} maps to {@code ji}, and {@code id} maps to
|
||||
* {@code in}. This continues to be the case, in order to not break
|
||||
* backwards compatibility.
|
||||
*
|
||||
* <p>The APIs added in 1.7 map between the old and new language codes,
|
||||
@ -1272,14 +1272,14 @@ public final class Locale implements Cloneable, Serializable {
|
||||
* {@link #toLanguageTag}.
|
||||
*
|
||||
* <p>Examples: <ul>
|
||||
* <li><tt>en</tt></li>
|
||||
* <li><tt>de_DE</tt></li>
|
||||
* <li><tt>_GB</tt></li>
|
||||
* <li><tt>en_US_WIN</tt></li>
|
||||
* <li><tt>de__POSIX</tt></li>
|
||||
* <li><tt>zh_CN_#Hans</tt></li>
|
||||
* <li><tt>zh_TW_#Hant-x-java</tt></li>
|
||||
* <li><tt>th_TH_TH_#u-nu-thai</tt></li></ul>
|
||||
* <li>{@code en}</li>
|
||||
* <li>{@code de_DE}</li>
|
||||
* <li>{@code _GB}</li>
|
||||
* <li>{@code en_US_WIN}</li>
|
||||
* <li>{@code de__POSIX}</li>
|
||||
* <li>{@code zh_CN_#Hans}</li>
|
||||
* <li>{@code zh_TW_#Hant-x-java}</li>
|
||||
* <li>{@code th_TH_TH_#u-nu-thai}</li></ul>
|
||||
*
|
||||
* @return A string representation of the Locale, for debugging.
|
||||
* @see #getDisplayName
|
||||
|
||||
@ -34,29 +34,29 @@ import java.io.Serializable;
|
||||
* An object that maps keys to values. A map cannot contain duplicate keys;
|
||||
* each key can map to at most one value.
|
||||
*
|
||||
* <p>This interface takes the place of the <tt>Dictionary</tt> class, which
|
||||
* <p>This interface takes the place of the {@code Dictionary} class, which
|
||||
* was a totally abstract class rather than an interface.
|
||||
*
|
||||
* <p>The <tt>Map</tt> interface provides three <i>collection views</i>, which
|
||||
* <p>The {@code Map} interface provides three <i>collection views</i>, which
|
||||
* allow a map's contents to be viewed as a set of keys, collection of values,
|
||||
* or set of key-value mappings. The <i>order</i> of a map is defined as
|
||||
* the order in which the iterators on the map's collection views return their
|
||||
* elements. Some map implementations, like the <tt>TreeMap</tt> class, make
|
||||
* specific guarantees as to their order; others, like the <tt>HashMap</tt>
|
||||
* elements. Some map implementations, like the {@code TreeMap} class, make
|
||||
* specific guarantees as to their order; others, like the {@code HashMap}
|
||||
* class, do not.
|
||||
*
|
||||
* <p>Note: great care must be exercised if mutable objects are used as map
|
||||
* keys. The behavior of a map is not specified if the value of an object is
|
||||
* changed in a manner that affects <tt>equals</tt> comparisons while the
|
||||
* changed in a manner that affects {@code equals} comparisons while the
|
||||
* object is a key in the map. A special case of this prohibition is that it
|
||||
* is not permissible for a map to contain itself as a key. While it is
|
||||
* permissible for a map to contain itself as a value, extreme caution is
|
||||
* advised: the <tt>equals</tt> and <tt>hashCode</tt> methods are no longer
|
||||
* advised: the {@code equals} and {@code hashCode} methods are no longer
|
||||
* well defined on such a map.
|
||||
*
|
||||
* <p>All general-purpose map implementation classes should provide two
|
||||
* "standard" constructors: a void (no arguments) constructor which creates an
|
||||
* empty map, and a constructor with a single argument of type <tt>Map</tt>,
|
||||
* empty map, and a constructor with a single argument of type {@code Map},
|
||||
* which creates a new map with the same key-value mappings as its argument.
|
||||
* In effect, the latter constructor allows the user to copy any map,
|
||||
* producing an equivalent map of the desired class. There is no way to
|
||||
@ -65,9 +65,9 @@ import java.io.Serializable;
|
||||
*
|
||||
* <p>The "destructive" methods contained in this interface, that is, the
|
||||
* methods that modify the map on which they operate, are specified to throw
|
||||
* <tt>UnsupportedOperationException</tt> if this map does not support the
|
||||
* {@code UnsupportedOperationException} if this map does not support the
|
||||
* operation. If this is the case, these methods may, but are not required
|
||||
* to, throw an <tt>UnsupportedOperationException</tt> if the invocation would
|
||||
* to, throw an {@code UnsupportedOperationException} if the invocation would
|
||||
* have no effect on the map. For example, invoking the {@link #putAll(Map)}
|
||||
* method on an unmodifiable map may, but is not required to, throw the
|
||||
* exception if the map whose mappings are to be "superimposed" is empty.
|
||||
@ -76,7 +76,7 @@ import java.io.Serializable;
|
||||
* may contain. For example, some implementations prohibit null keys and
|
||||
* values, and some have restrictions on the types of their keys. Attempting
|
||||
* to insert an ineligible key or value throws an unchecked exception,
|
||||
* typically <tt>NullPointerException</tt> or <tt>ClassCastException</tt>.
|
||||
* typically {@code NullPointerException} or {@code ClassCastException}.
|
||||
* Attempting to query the presence of an ineligible key or value may throw an
|
||||
* exception, or it may simply return false; some implementations will exhibit
|
||||
* the former behavior and some will exhibit the latter. More generally,
|
||||
@ -89,13 +89,13 @@ import java.io.Serializable;
|
||||
* <p>Many methods in Collections Framework interfaces are defined
|
||||
* in terms of the {@link Object#equals(Object) equals} method. For
|
||||
* example, the specification for the {@link #containsKey(Object)
|
||||
* containsKey(Object key)} method says: "returns <tt>true</tt> if and
|
||||
* only if this map contains a mapping for a key <tt>k</tt> such that
|
||||
* <tt>(key==null ? k==null : key.equals(k))</tt>." This specification should
|
||||
* <i>not</i> be construed to imply that invoking <tt>Map.containsKey</tt>
|
||||
* with a non-null argument <tt>key</tt> will cause <tt>key.equals(k)</tt> to
|
||||
* be invoked for any key <tt>k</tt>. Implementations are free to
|
||||
* implement optimizations whereby the <tt>equals</tt> invocation is avoided,
|
||||
* containsKey(Object key)} method says: "returns {@code true} if and
|
||||
* only if this map contains a mapping for a key {@code k} such that
|
||||
* {@code (key==null ? k==null : key.equals(k))}." This specification should
|
||||
* <i>not</i> be construed to imply that invoking {@code Map.containsKey}
|
||||
* with a non-null argument {@code key} will cause {@code key.equals(k)} to
|
||||
* be invoked for any key {@code k}. Implementations are free to
|
||||
* implement optimizations whereby the {@code equals} invocation is avoided,
|
||||
* for example, by first comparing the hash codes of the two keys. (The
|
||||
* {@link Object#hashCode()} specification guarantees that two objects with
|
||||
* unequal hash codes cannot be equal.) More generally, implementations of
|
||||
@ -131,29 +131,29 @@ public interface Map<K,V> {
|
||||
|
||||
/**
|
||||
* Returns the number of key-value mappings in this map. If the
|
||||
* map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
|
||||
* <tt>Integer.MAX_VALUE</tt>.
|
||||
* map contains more than {@code Integer.MAX_VALUE} elements, returns
|
||||
* {@code Integer.MAX_VALUE}.
|
||||
*
|
||||
* @return the number of key-value mappings in this map
|
||||
*/
|
||||
int size();
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map contains no key-value mappings.
|
||||
* Returns {@code true} if this map contains no key-value mappings.
|
||||
*
|
||||
* @return <tt>true</tt> if this map contains no key-value mappings
|
||||
* @return {@code true} if this map contains no key-value mappings
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map contains a mapping for the specified
|
||||
* key. More formally, returns <tt>true</tt> if and only if
|
||||
* this map contains a mapping for a key <tt>k</tt> such that
|
||||
* <tt>(key==null ? k==null : key.equals(k))</tt>. (There can be
|
||||
* Returns {@code true} if this map contains a mapping for the specified
|
||||
* key. More formally, returns {@code true} if and only if
|
||||
* this map contains a mapping for a key {@code k} such that
|
||||
* {@code Objects.equals(key, k)}. (There can be
|
||||
* at most one such mapping.)
|
||||
*
|
||||
* @param key key whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map contains a mapping for the specified
|
||||
* @return {@code true} if this map contains a mapping for the specified
|
||||
* key
|
||||
* @throws ClassCastException if the key is of an inappropriate type for
|
||||
* this map
|
||||
@ -165,15 +165,15 @@ public interface Map<K,V> {
|
||||
boolean containsKey(Object key);
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map maps one or more keys to the
|
||||
* specified value. More formally, returns <tt>true</tt> if and only if
|
||||
* this map contains at least one mapping to a value <tt>v</tt> such that
|
||||
* <tt>(value==null ? v==null : value.equals(v))</tt>. This operation
|
||||
* Returns {@code true} if this map maps one or more keys to the
|
||||
* specified value. More formally, returns {@code true} if and only if
|
||||
* this map contains at least one mapping to a value {@code v} such that
|
||||
* {@code Objects.equals(value, v)}. This operation
|
||||
* will probably require time linear in the map size for most
|
||||
* implementations of the <tt>Map</tt> interface.
|
||||
* implementations of the {@code Map} interface.
|
||||
*
|
||||
* @param value value whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map maps one or more keys to the
|
||||
* @return {@code true} if this map maps one or more keys to the
|
||||
* specified value
|
||||
* @throws ClassCastException if the value is of an inappropriate type for
|
||||
* this map
|
||||
@ -189,8 +189,9 @@ public interface Map<K,V> {
|
||||
* or {@code null} if this map contains no mapping for the key.
|
||||
*
|
||||
* <p>More formally, if this map contains a mapping from a key
|
||||
* {@code k} to a value {@code v} such that {@code (key==null ? k==null :
|
||||
* key.equals(k))}, then this method returns {@code v}; otherwise
|
||||
* {@code k} to a value {@code v} such that
|
||||
* {@code Objects.equals(key, k)},
|
||||
* then this method returns {@code v}; otherwise
|
||||
* it returns {@code null}. (There can be at most one such mapping.)
|
||||
*
|
||||
* <p>If this map permits null values, then a return value of
|
||||
@ -217,18 +218,18 @@ public interface Map<K,V> {
|
||||
* Associates the specified value with the specified key in this map
|
||||
* (optional operation). If the map previously contained a mapping for
|
||||
* the key, the old value is replaced by the specified value. (A map
|
||||
* <tt>m</tt> is said to contain a mapping for a key <tt>k</tt> if and only
|
||||
* {@code m} is said to contain a mapping for a key {@code k} if and only
|
||||
* if {@link #containsKey(Object) m.containsKey(k)} would return
|
||||
* <tt>true</tt>.)
|
||||
* {@code true}.)
|
||||
*
|
||||
* @param key key with which the specified value is to be associated
|
||||
* @param value value to be associated with the specified key
|
||||
* @return the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* (A <tt>null</tt> return can also indicate that the map
|
||||
* previously associated <tt>null</tt> with <tt>key</tt>,
|
||||
* if the implementation supports <tt>null</tt> values.)
|
||||
* @throws UnsupportedOperationException if the <tt>put</tt> operation
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* (A {@code null} return can also indicate that the map
|
||||
* previously associated {@code null} with {@code key},
|
||||
* if the implementation supports {@code null} values.)
|
||||
* @throws UnsupportedOperationException if the {@code put} operation
|
||||
* is not supported by this map
|
||||
* @throws ClassCastException if the class of the specified key or value
|
||||
* prevents it from being stored in this map
|
||||
@ -242,25 +243,25 @@ public interface Map<K,V> {
|
||||
/**
|
||||
* Removes the mapping for a key from this map if it is present
|
||||
* (optional operation). More formally, if this map contains a mapping
|
||||
* from key <tt>k</tt> to value <tt>v</tt> such that
|
||||
* <code>(key==null ? k==null : key.equals(k))</code>, that mapping
|
||||
* from key {@code k} to value {@code v} such that
|
||||
* {@code Objects.equals(key, k)}, that mapping
|
||||
* is removed. (The map can contain at most one such mapping.)
|
||||
*
|
||||
* <p>Returns the value to which this map previously associated the key,
|
||||
* or <tt>null</tt> if the map contained no mapping for the key.
|
||||
* or {@code null} if the map contained no mapping for the key.
|
||||
*
|
||||
* <p>If this map permits null values, then a return value of
|
||||
* <tt>null</tt> does not <i>necessarily</i> indicate that the map
|
||||
* {@code null} does not <i>necessarily</i> indicate that the map
|
||||
* contained no mapping for the key; it's also possible that the map
|
||||
* explicitly mapped the key to <tt>null</tt>.
|
||||
* explicitly mapped the key to {@code null}.
|
||||
*
|
||||
* <p>The map will not contain a mapping for the specified key once the
|
||||
* call returns.
|
||||
*
|
||||
* @param key key whose mapping is to be removed from the map
|
||||
* @return the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* @throws UnsupportedOperationException if the <tt>remove</tt> operation
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* @throws UnsupportedOperationException if the {@code remove} operation
|
||||
* is not supported by this map
|
||||
* @throws ClassCastException if the key is of an inappropriate type for
|
||||
* this map
|
||||
@ -278,12 +279,12 @@ public interface Map<K,V> {
|
||||
* Copies all of the mappings from the specified map to this map
|
||||
* (optional operation). The effect of this call is equivalent to that
|
||||
* of calling {@link #put(Object,Object) put(k, v)} on this map once
|
||||
* for each mapping from key <tt>k</tt> to value <tt>v</tt> in the
|
||||
* for each mapping from key {@code k} to value {@code v} in the
|
||||
* specified map. The behavior of this operation is undefined if the
|
||||
* specified map is modified while the operation is in progress.
|
||||
*
|
||||
* @param m mappings to be stored in this map
|
||||
* @throws UnsupportedOperationException if the <tt>putAll</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code putAll} operation
|
||||
* is not supported by this map
|
||||
* @throws ClassCastException if the class of a key or value in the
|
||||
* specified map prevents it from being stored in this map
|
||||
@ -299,7 +300,7 @@ public interface Map<K,V> {
|
||||
* Removes all of the mappings from this map (optional operation).
|
||||
* The map will be empty after this call returns.
|
||||
*
|
||||
* @throws UnsupportedOperationException if the <tt>clear</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code clear} operation
|
||||
* is not supported by this map
|
||||
*/
|
||||
void clear();
|
||||
@ -312,12 +313,12 @@ public interface Map<K,V> {
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation), the results of
|
||||
* the iterator's own {@code remove} operation), the results of
|
||||
* the iteration are undefined. The set supports element removal,
|
||||
* which removes the corresponding mapping from the map, via the
|
||||
* <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
|
||||
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
|
||||
* operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
|
||||
* {@code Iterator.remove}, {@code Set.remove},
|
||||
* {@code removeAll}, {@code retainAll}, and {@code clear}
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
*
|
||||
* @return a set view of the keys contained in this map
|
||||
@ -329,13 +330,13 @@ public interface Map<K,V> {
|
||||
* The collection is backed by the map, so changes to the map are
|
||||
* reflected in the collection, and vice-versa. If the map is
|
||||
* modified while an iteration over the collection is in progress
|
||||
* (except through the iterator's own <tt>remove</tt> operation),
|
||||
* (except through the iterator's own {@code remove} operation),
|
||||
* the results of the iteration are undefined. The collection
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Collection.remove</tt>, <tt>removeAll</tt>,
|
||||
* <tt>retainAll</tt> and <tt>clear</tt> operations. It does not
|
||||
* support the <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Collection.remove}, {@code removeAll},
|
||||
* {@code retainAll} and {@code clear} operations. It does not
|
||||
* support the {@code add} or {@code addAll} operations.
|
||||
*
|
||||
* @return a collection view of the values contained in this map
|
||||
*/
|
||||
@ -346,28 +347,28 @@ public interface Map<K,V> {
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation, or through the
|
||||
* <tt>setValue</tt> operation on a map entry returned by the
|
||||
* the iterator's own {@code remove} operation, or through the
|
||||
* {@code setValue} operation on a map entry returned by the
|
||||
* iterator) the results of the iteration are undefined. The set
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
|
||||
* <tt>clear</tt> operations. It does not support the
|
||||
* <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Set.remove}, {@code removeAll}, {@code retainAll} and
|
||||
* {@code clear} operations. It does not support the
|
||||
* {@code add} or {@code addAll} operations.
|
||||
*
|
||||
* @return a set view of the mappings contained in this map
|
||||
*/
|
||||
Set<Map.Entry<K, V>> entrySet();
|
||||
|
||||
/**
|
||||
* A map entry (key-value pair). The <tt>Map.entrySet</tt> method returns
|
||||
* A map entry (key-value pair). The {@code Map.entrySet} method returns
|
||||
* a collection-view of the map, whose elements are of this class. The
|
||||
* <i>only</i> way to obtain a reference to a map entry is from the
|
||||
* iterator of this collection-view. These <tt>Map.Entry</tt> objects are
|
||||
* iterator of this collection-view. These {@code Map.Entry} objects are
|
||||
* valid <i>only</i> for the duration of the iteration; more formally,
|
||||
* the behavior of a map entry is undefined if the backing map has been
|
||||
* modified after the entry was returned by the iterator, except through
|
||||
* the <tt>setValue</tt> operation on the map entry.
|
||||
* the {@code setValue} operation on the map entry.
|
||||
*
|
||||
* @see Map#entrySet()
|
||||
* @since 1.2
|
||||
@ -386,7 +387,7 @@ public interface Map<K,V> {
|
||||
/**
|
||||
* Returns the value corresponding to this entry. If the mapping
|
||||
* has been removed from the backing map (by the iterator's
|
||||
* <tt>remove</tt> operation), the results of this call are undefined.
|
||||
* {@code remove} operation), the results of this call are undefined.
|
||||
*
|
||||
* @return the value corresponding to this entry
|
||||
* @throws IllegalStateException implementations may, but are not
|
||||
@ -399,11 +400,11 @@ public interface Map<K,V> {
|
||||
* Replaces the value corresponding to this entry with the specified
|
||||
* value (optional operation). (Writes through to the map.) The
|
||||
* behavior of this call is undefined if the mapping has already been
|
||||
* removed from the map (by the iterator's <tt>remove</tt> operation).
|
||||
* removed from the map (by the iterator's {@code remove} operation).
|
||||
*
|
||||
* @param value new value to be stored in this entry
|
||||
* @return old value corresponding to the entry
|
||||
* @throws UnsupportedOperationException if the <tt>put</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code put} operation
|
||||
* is not supported by the backing map
|
||||
* @throws ClassCastException if the class of the specified value
|
||||
* prevents it from being stored in the backing map
|
||||
@ -419,34 +420,34 @@ public interface Map<K,V> {
|
||||
|
||||
/**
|
||||
* Compares the specified object with this entry for equality.
|
||||
* Returns <tt>true</tt> if the given object is also a map entry and
|
||||
* Returns {@code true} if the given object is also a map entry and
|
||||
* the two entries represent the same mapping. More formally, two
|
||||
* entries <tt>e1</tt> and <tt>e2</tt> represent the same mapping
|
||||
* entries {@code e1} and {@code e2} represent the same mapping
|
||||
* if<pre>
|
||||
* (e1.getKey()==null ?
|
||||
* e2.getKey()==null : e1.getKey().equals(e2.getKey())) &&
|
||||
* (e1.getValue()==null ?
|
||||
* e2.getValue()==null : e1.getValue().equals(e2.getValue()))
|
||||
* </pre>
|
||||
* This ensures that the <tt>equals</tt> method works properly across
|
||||
* different implementations of the <tt>Map.Entry</tt> interface.
|
||||
* This ensures that the {@code equals} method works properly across
|
||||
* different implementations of the {@code Map.Entry} interface.
|
||||
*
|
||||
* @param o object to be compared for equality with this map entry
|
||||
* @return <tt>true</tt> if the specified object is equal to this map
|
||||
* @return {@code true} if the specified object is equal to this map
|
||||
* entry
|
||||
*/
|
||||
boolean equals(Object o);
|
||||
|
||||
/**
|
||||
* Returns the hash code value for this map entry. The hash code
|
||||
* of a map entry <tt>e</tt> is defined to be: <pre>
|
||||
* of a map entry {@code e} is defined to be: <pre>
|
||||
* (e.getKey()==null ? 0 : e.getKey().hashCode()) ^
|
||||
* (e.getValue()==null ? 0 : e.getValue().hashCode())
|
||||
* </pre>
|
||||
* This ensures that <tt>e1.equals(e2)</tt> implies that
|
||||
* <tt>e1.hashCode()==e2.hashCode()</tt> for any two Entries
|
||||
* <tt>e1</tt> and <tt>e2</tt>, as required by the general
|
||||
* contract of <tt>Object.hashCode</tt>.
|
||||
* This ensures that {@code e1.equals(e2)} implies that
|
||||
* {@code e1.hashCode()==e2.hashCode()} for any two Entries
|
||||
* {@code e1} and {@code e2}, as required by the general
|
||||
* contract of {@code Object.hashCode}.
|
||||
*
|
||||
* @return the hash code value for this map entry
|
||||
* @see Object#hashCode()
|
||||
@ -532,24 +533,24 @@ public interface Map<K,V> {
|
||||
|
||||
/**
|
||||
* Compares the specified object with this map for equality. Returns
|
||||
* <tt>true</tt> if the given object is also a map and the two maps
|
||||
* represent the same mappings. More formally, two maps <tt>m1</tt> and
|
||||
* <tt>m2</tt> represent the same mappings if
|
||||
* <tt>m1.entrySet().equals(m2.entrySet())</tt>. This ensures that the
|
||||
* <tt>equals</tt> method works properly across different implementations
|
||||
* of the <tt>Map</tt> interface.
|
||||
* {@code true} if the given object is also a map and the two maps
|
||||
* represent the same mappings. More formally, two maps {@code m1} and
|
||||
* {@code m2} represent the same mappings if
|
||||
* {@code m1.entrySet().equals(m2.entrySet())}. This ensures that the
|
||||
* {@code equals} method works properly across different implementations
|
||||
* of the {@code Map} interface.
|
||||
*
|
||||
* @param o object to be compared for equality with this map
|
||||
* @return <tt>true</tt> if the specified object is equal to this map
|
||||
* @return {@code true} if the specified object is equal to this map
|
||||
*/
|
||||
boolean equals(Object o);
|
||||
|
||||
/**
|
||||
* Returns the hash code value for this map. The hash code of a map is
|
||||
* defined to be the sum of the hash codes of each entry in the map's
|
||||
* <tt>entrySet()</tt> view. This ensures that <tt>m1.equals(m2)</tt>
|
||||
* implies that <tt>m1.hashCode()==m2.hashCode()</tt> for any two maps
|
||||
* <tt>m1</tt> and <tt>m2</tt>, as required by the general contract of
|
||||
* {@code entrySet()} view. This ensures that {@code m1.equals(m2)}
|
||||
* implies that {@code m1.hashCode()==m2.hashCode()} for any two maps
|
||||
* {@code m1} and {@code m2}, as required by the general contract of
|
||||
* {@link Object#hashCode}.
|
||||
*
|
||||
* @return the hash code value for this map
|
||||
|
||||
@ -30,7 +30,7 @@ package java.util;
|
||||
* have a corresponding argument or if an argument index refers to an argument
|
||||
* that does not exist.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -28,7 +28,7 @@ package java.util;
|
||||
/**
|
||||
* Unchecked exception thrown when the format width is required.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -64,10 +64,10 @@ class MissingResourceException extends RuntimeException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>MissingResourceException</code> with
|
||||
* <code>message</code>, <code>className</code>, <code>key</code>,
|
||||
* and <code>cause</code>. This constructor is package private for
|
||||
* use by <code>ResourceBundle.getBundle</code>.
|
||||
* Constructs a {@code MissingResourceException} with
|
||||
* {@code message}, {@code className}, {@code key},
|
||||
* and {@code cause}. This constructor is package private for
|
||||
* use by {@code ResourceBundle.getBundle}.
|
||||
*
|
||||
* @param message
|
||||
* the detail message
|
||||
|
||||
@ -39,7 +39,7 @@ class NoSuchElementException extends RuntimeException {
|
||||
private static final long serialVersionUID = 6769829250639411880L;
|
||||
|
||||
/**
|
||||
* Constructs a <code>NoSuchElementException</code> with <tt>null</tt>
|
||||
* Constructs a {@code NoSuchElementException} with {@code null}
|
||||
* as its error message string.
|
||||
*/
|
||||
public NoSuchElementException() {
|
||||
@ -47,9 +47,9 @@ class NoSuchElementException extends RuntimeException {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a <code>NoSuchElementException</code>, saving a reference
|
||||
* to the error message string <tt>s</tt> for later retrieval by the
|
||||
* <tt>getMessage</tt> method.
|
||||
* Constructs a {@code NoSuchElementException}, saving a reference
|
||||
* to the error message string {@code s} for later retrieval by the
|
||||
* {@code getMessage} method.
|
||||
*
|
||||
* @param s the detail message.
|
||||
*/
|
||||
|
||||
@ -31,11 +31,11 @@ package java.util;
|
||||
* object that the application wants to have observed.
|
||||
* <p>
|
||||
* An observable object can have one or more observers. An observer
|
||||
* may be any object that implements interface <tt>Observer</tt>. After an
|
||||
* may be any object that implements interface {@code Observer}. After an
|
||||
* observable instance changes, an application calling the
|
||||
* <code>Observable</code>'s <code>notifyObservers</code> method
|
||||
* {@code Observable}'s {@code notifyObservers} method
|
||||
* causes all of its observers to be notified of the change by a call
|
||||
* to their <code>update</code> method.
|
||||
* to their {@code update} method.
|
||||
* <p>
|
||||
* The order in which notifications will be delivered is unspecified.
|
||||
* The default implementation provided in the Observable class will
|
||||
@ -45,12 +45,12 @@ package java.util;
|
||||
* subclass follows this order, as they choose.
|
||||
* <p>
|
||||
* Note that this notification mechanism has nothing to do with threads
|
||||
* and is completely separate from the <tt>wait</tt> and <tt>notify</tt>
|
||||
* mechanism of class <tt>Object</tt>.
|
||||
* and is completely separate from the {@code wait} and {@code notify}
|
||||
* mechanism of class {@code Object}.
|
||||
* <p>
|
||||
* When an observable object is newly created, its set of observers is
|
||||
* empty. Two observers are considered the same if and only if the
|
||||
* <tt>equals</tt> method returns true for them.
|
||||
* {@code equals} method returns true for them.
|
||||
*
|
||||
* @author Chris Warth
|
||||
* @see java.util.Observable#notifyObservers()
|
||||
@ -88,7 +88,7 @@ public class Observable {
|
||||
|
||||
/**
|
||||
* Deletes an observer from the set of observers of this object.
|
||||
* Passing <CODE>null</CODE> to this method will have no effect.
|
||||
* Passing {@code null} to this method will have no effect.
|
||||
* @param o the observer to be deleted.
|
||||
*/
|
||||
public synchronized void deleteObserver(Observer o) {
|
||||
@ -97,15 +97,15 @@ public class Observable {
|
||||
|
||||
/**
|
||||
* If this object has changed, as indicated by the
|
||||
* <code>hasChanged</code> method, then notify all of its observers
|
||||
* and then call the <code>clearChanged</code> method to
|
||||
* {@code hasChanged} method, then notify all of its observers
|
||||
* and then call the {@code clearChanged} method to
|
||||
* indicate that this object has no longer changed.
|
||||
* <p>
|
||||
* Each observer has its <code>update</code> method called with two
|
||||
* arguments: this observable object and <code>null</code>. In other
|
||||
* Each observer has its {@code update} method called with two
|
||||
* arguments: this observable object and {@code null}. In other
|
||||
* words, this method is equivalent to:
|
||||
* <blockquote><tt>
|
||||
* notifyObservers(null)</tt></blockquote>
|
||||
* <blockquote>{@code
|
||||
* notifyObservers(null)}</blockquote>
|
||||
*
|
||||
* @see java.util.Observable#clearChanged()
|
||||
* @see java.util.Observable#hasChanged()
|
||||
@ -117,12 +117,12 @@ public class Observable {
|
||||
|
||||
/**
|
||||
* If this object has changed, as indicated by the
|
||||
* <code>hasChanged</code> method, then notify all of its observers
|
||||
* and then call the <code>clearChanged</code> method to indicate
|
||||
* {@code hasChanged} method, then notify all of its observers
|
||||
* and then call the {@code clearChanged} method to indicate
|
||||
* that this object has no longer changed.
|
||||
* <p>
|
||||
* Each observer has its <code>update</code> method called with two
|
||||
* arguments: this observable object and the <code>arg</code> argument.
|
||||
* Each observer has its {@code update} method called with two
|
||||
* arguments: this observable object and the {@code arg} argument.
|
||||
*
|
||||
* @param arg any object.
|
||||
* @see java.util.Observable#clearChanged()
|
||||
@ -167,8 +167,8 @@ public class Observable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks this <tt>Observable</tt> object as having been changed; the
|
||||
* <tt>hasChanged</tt> method will now return <tt>true</tt>.
|
||||
* Marks this {@code Observable} object as having been changed; the
|
||||
* {@code hasChanged} method will now return {@code true}.
|
||||
*/
|
||||
protected synchronized void setChanged() {
|
||||
changed = true;
|
||||
@ -177,9 +177,9 @@ public class Observable {
|
||||
/**
|
||||
* Indicates that this object has no longer changed, or that it has
|
||||
* already notified all of its observers of its most recent change,
|
||||
* so that the <tt>hasChanged</tt> method will now return <tt>false</tt>.
|
||||
* so that the {@code hasChanged} method will now return {@code false}.
|
||||
* This method is called automatically by the
|
||||
* <code>notifyObservers</code> methods.
|
||||
* {@code notifyObservers} methods.
|
||||
*
|
||||
* @see java.util.Observable#notifyObservers()
|
||||
* @see java.util.Observable#notifyObservers(java.lang.Object)
|
||||
@ -191,10 +191,10 @@ public class Observable {
|
||||
/**
|
||||
* Tests if this object has changed.
|
||||
*
|
||||
* @return <code>true</code> if and only if the <code>setChanged</code>
|
||||
* @return {@code true} if and only if the {@code setChanged}
|
||||
* method has been called more recently than the
|
||||
* <code>clearChanged</code> method on this object;
|
||||
* <code>false</code> otherwise.
|
||||
* {@code clearChanged} method on this object;
|
||||
* {@code false} otherwise.
|
||||
* @see java.util.Observable#clearChanged()
|
||||
* @see java.util.Observable#setChanged()
|
||||
*/
|
||||
@ -203,7 +203,7 @@ public class Observable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of observers of this <tt>Observable</tt> object.
|
||||
* Returns the number of observers of this {@code Observable} object.
|
||||
*
|
||||
* @return the number of observers of this object.
|
||||
*/
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* A class can implement the <code>Observer</code> interface when it
|
||||
* A class can implement the {@code Observer} interface when it
|
||||
* wants to be informed of changes in observable objects.
|
||||
*
|
||||
* @author Chris Warth
|
||||
@ -35,12 +35,12 @@ package java.util;
|
||||
public interface Observer {
|
||||
/**
|
||||
* This method is called whenever the observed object is changed. An
|
||||
* application calls an <tt>Observable</tt> object's
|
||||
* <code>notifyObservers</code> method to have all the object's
|
||||
* application calls an {@code Observable} object's
|
||||
* {@code notifyObservers} method to have all the object's
|
||||
* observers notified of the change.
|
||||
*
|
||||
* @param o the observable object.
|
||||
* @param arg an argument passed to the <code>notifyObservers</code>
|
||||
* @param arg an argument passed to the {@code notifyObservers}
|
||||
* method.
|
||||
*/
|
||||
void update(Observable o, Object arg);
|
||||
|
||||
@ -60,12 +60,12 @@ import jdk.internal.util.xml.PropertiesDefaultHandler;
|
||||
* object that contains a non-{@code String} key.
|
||||
*
|
||||
* <p>
|
||||
* The {@link #load(java.io.Reader) load(Reader)} <tt>/</tt>
|
||||
* The {@link #load(java.io.Reader) load(Reader)} {@code /}
|
||||
* {@link #store(java.io.Writer, java.lang.String) store(Writer, String)}
|
||||
* methods load and store properties from and to a character based stream
|
||||
* in a simple line-oriented format specified below.
|
||||
*
|
||||
* The {@link #load(java.io.InputStream) load(InputStream)} <tt>/</tt>
|
||||
* The {@link #load(java.io.InputStream) load(InputStream)} {@code /}
|
||||
* {@link #store(java.io.OutputStream, java.lang.String) store(OutputStream, String)}
|
||||
* methods work the same way as the load(Reader)/store(Writer, String) pair, except
|
||||
* the input/output stream is encoded in ISO 8859-1 character encoding.
|
||||
@ -105,7 +105,7 @@ import jdk.internal.util.xml.PropertiesDefaultHandler;
|
||||
* </pre>
|
||||
*
|
||||
* <p>This class is thread-safe: multiple threads can share a single
|
||||
* <tt>Properties</tt> object without the need for external synchronization.
|
||||
* {@code Properties} object without the need for external synchronization.
|
||||
*
|
||||
* @author Arthur van Hoff
|
||||
* @author Michael McCloskey
|
||||
@ -144,13 +144,13 @@ class Properties extends Hashtable<Object,Object> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the <tt>Hashtable</tt> method {@code put}. Provided for
|
||||
* parallelism with the <tt>getProperty</tt> method. Enforces use of
|
||||
* Calls the {@code Hashtable} method {@code put}. Provided for
|
||||
* parallelism with the {@code getProperty} method. Enforces use of
|
||||
* strings for property keys and values. The value returned is the
|
||||
* result of the <tt>Hashtable</tt> call to {@code put}.
|
||||
* result of the {@code Hashtable} call to {@code put}.
|
||||
*
|
||||
* @param key the key to be placed into this property list.
|
||||
* @param value the value corresponding to <tt>key</tt>.
|
||||
* @param value the value corresponding to {@code key}.
|
||||
* @return the previous value of the specified key in this property
|
||||
* list, or {@code null} if it did not have one.
|
||||
* @see #getProperty
|
||||
@ -756,7 +756,7 @@ class Properties extends Hashtable<Object,Object> {
|
||||
* @param writer an output character stream writer.
|
||||
* @param comments a description of the property list.
|
||||
* @exception IOException if writing this property list to the specified
|
||||
* output stream throws an <tt>IOException</tt>.
|
||||
* output stream throws an {@code IOException}.
|
||||
* @exception ClassCastException if this {@code Properties} object
|
||||
* contains any keys or values that are not {@code Strings}.
|
||||
* @exception NullPointerException if {@code writer} is null.
|
||||
@ -803,7 +803,7 @@ class Properties extends Hashtable<Object,Object> {
|
||||
* @param out an output stream.
|
||||
* @param comments a description of the property list.
|
||||
* @exception IOException if writing this property list to the specified
|
||||
* output stream throws an <tt>IOException</tt>.
|
||||
* output stream throws an {@code IOException}.
|
||||
* @exception ClassCastException if this {@code Properties} object
|
||||
* contains any keys or values that are not {@code Strings}.
|
||||
* @exception NullPointerException if {@code out} is null.
|
||||
@ -860,7 +860,7 @@ class Properties extends Hashtable<Object,Object> {
|
||||
*
|
||||
* @param in the input stream from which to read the XML document.
|
||||
* @throws IOException if reading from the specified input stream
|
||||
* results in an <tt>IOException</tt>.
|
||||
* results in an {@code IOException}.
|
||||
* @throws java.io.UnsupportedEncodingException if the document's encoding
|
||||
* declaration can be read and it specifies an encoding that is not
|
||||
* supported
|
||||
@ -885,15 +885,15 @@ class Properties extends Hashtable<Object,Object> {
|
||||
* Emits an XML document representing all of the properties contained
|
||||
* in this table.
|
||||
*
|
||||
* <p> An invocation of this method of the form <tt>props.storeToXML(os,
|
||||
* comment)</tt> behaves in exactly the same way as the invocation
|
||||
* <tt>props.storeToXML(os, comment, "UTF-8");</tt>.
|
||||
* <p> An invocation of this method of the form {@code props.storeToXML(os,
|
||||
* comment)} behaves in exactly the same way as the invocation
|
||||
* {@code props.storeToXML(os, comment, "UTF-8");}.
|
||||
*
|
||||
* @param os the output stream on which to emit the XML document.
|
||||
* @param comment a description of the property list, or {@code null}
|
||||
* if no comment is desired.
|
||||
* @throws IOException if writing to the specified output stream
|
||||
* results in an <tt>IOException</tt>.
|
||||
* results in an {@code IOException}.
|
||||
* @throws NullPointerException if {@code os} is null.
|
||||
* @throws ClassCastException if this {@code Properties} object
|
||||
* contains any keys or values that are not
|
||||
@ -933,7 +933,7 @@ class Properties extends Hashtable<Object,Object> {
|
||||
* character encoding</a>
|
||||
*
|
||||
* @throws IOException if writing to the specified output stream
|
||||
* results in an <tt>IOException</tt>.
|
||||
* results in an {@code IOException}.
|
||||
* @throws java.io.UnsupportedEncodingException if the encoding is not
|
||||
* supported by the implementation.
|
||||
* @throws NullPointerException if {@code os} is {@code null},
|
||||
@ -1016,10 +1016,10 @@ class Properties extends Hashtable<Object,Object> {
|
||||
* including distinct keys in the default property list if a key
|
||||
* of the same name has not already been found from the main
|
||||
* properties list. Properties whose key or value is not
|
||||
* of type <tt>String</tt> are omitted.
|
||||
* of type {@code String} are omitted.
|
||||
* <p>
|
||||
* The returned set is not backed by the <tt>Properties</tt> object.
|
||||
* Changes to this <tt>Properties</tt> are not reflected in the set,
|
||||
* The returned set is not backed by the {@code Properties} object.
|
||||
* Changes to this {@code Properties} are not reflected in the set,
|
||||
* or vice versa.
|
||||
*
|
||||
* @return a set of keys in this property list where
|
||||
|
||||
@ -26,27 +26,27 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* Marker interface used by <tt>List</tt> implementations to indicate that
|
||||
* Marker interface used by {@code List} implementations to indicate that
|
||||
* they support fast (generally constant time) random access. The primary
|
||||
* purpose of this interface is to allow generic algorithms to alter their
|
||||
* behavior to provide good performance when applied to either random or
|
||||
* sequential access lists.
|
||||
*
|
||||
* <p>The best algorithms for manipulating random access lists (such as
|
||||
* <tt>ArrayList</tt>) can produce quadratic behavior when applied to
|
||||
* sequential access lists (such as <tt>LinkedList</tt>). Generic list
|
||||
* {@code ArrayList}) can produce quadratic behavior when applied to
|
||||
* sequential access lists (such as {@code LinkedList}). Generic list
|
||||
* algorithms are encouraged to check whether the given list is an
|
||||
* <tt>instanceof</tt> this interface before applying an algorithm that would
|
||||
* {@code instanceof} this interface before applying an algorithm that would
|
||||
* provide poor performance if it were applied to a sequential access list,
|
||||
* and to alter their behavior if necessary to guarantee acceptable
|
||||
* performance.
|
||||
*
|
||||
* <p>It is recognized that the distinction between random and sequential
|
||||
* access is often fuzzy. For example, some <tt>List</tt> implementations
|
||||
* access is often fuzzy. For example, some {@code List} implementations
|
||||
* provide asymptotically linear access times if they get huge, but constant
|
||||
* access times in practice. Such a <tt>List</tt> implementation
|
||||
* access times in practice. Such a {@code List} implementation
|
||||
* should generally implement this interface. As a rule of thumb, a
|
||||
* <tt>List</tt> implementation should implement this interface if,
|
||||
* {@code List} implementation should implement this interface if,
|
||||
* for typical instances of the class, this loop:
|
||||
* <pre>
|
||||
* for (int i=0, n=list.size(); i < n; i++)
|
||||
|
||||
@ -123,19 +123,19 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains no elements.
|
||||
* Returns {@code true} if this set contains no elements.
|
||||
*
|
||||
* @return <tt>true</tt> if this set contains no elements
|
||||
* @return {@code true} if this set contains no elements
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return elements == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains the specified element.
|
||||
* Returns {@code true} if this set contains the specified element.
|
||||
*
|
||||
* @param e element to be checked for containment in this collection
|
||||
* @return <tt>true</tt> if this set contains the specified element
|
||||
* @return {@code true} if this set contains the specified element
|
||||
*/
|
||||
public boolean contains(Object e) {
|
||||
if (e == null)
|
||||
@ -153,9 +153,9 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* Adds the specified element to this set if it is not already present.
|
||||
*
|
||||
* @param e element to be added to this set
|
||||
* @return <tt>true</tt> if the set changed as a result of the call
|
||||
* @return {@code true} if the set changed as a result of the call
|
||||
*
|
||||
* @throws NullPointerException if <tt>e</tt> is null
|
||||
* @throws NullPointerException if {@code e} is null
|
||||
*/
|
||||
public boolean add(E e) {
|
||||
typeCheck(e);
|
||||
@ -169,7 +169,7 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* Removes the specified element from this set if it is present.
|
||||
*
|
||||
* @param e element to be removed from this set, if present
|
||||
* @return <tt>true</tt> if the set contained the specified element
|
||||
* @return {@code true} if the set contained the specified element
|
||||
*/
|
||||
public boolean remove(Object e) {
|
||||
if (e == null)
|
||||
@ -186,11 +186,11 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
// Bulk Operations
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains all of the elements
|
||||
* Returns {@code true} if this set contains all of the elements
|
||||
* in the specified collection.
|
||||
*
|
||||
* @param c collection to be checked for containment in this set
|
||||
* @return <tt>true</tt> if this set contains all of the elements
|
||||
* @return {@code true} if this set contains all of the elements
|
||||
* in the specified collection
|
||||
* @throws NullPointerException if the specified collection is null
|
||||
*/
|
||||
@ -209,7 +209,7 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* Adds all of the elements in the specified collection to this set.
|
||||
*
|
||||
* @param c collection whose elements are to be added to this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws NullPointerException if the specified collection or any
|
||||
* of its elements are null
|
||||
*/
|
||||
@ -236,7 +236,7 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* the specified collection.
|
||||
*
|
||||
* @param c elements to be removed from this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws NullPointerException if the specified collection is null
|
||||
*/
|
||||
public boolean removeAll(Collection<?> c) {
|
||||
@ -257,7 +257,7 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
* specified collection.
|
||||
*
|
||||
* @param c elements to be retained in this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws NullPointerException if the specified collection is null
|
||||
*/
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
@ -285,12 +285,12 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
|
||||
/**
|
||||
* Compares the specified object with this set for equality. Returns
|
||||
* <tt>true</tt> if the given object is also a set, the two sets have
|
||||
* {@code true} if the given object is also a set, the two sets have
|
||||
* the same size, and every member of the given set is contained in
|
||||
* this set.
|
||||
*
|
||||
* @param o object to be compared for equality with this set
|
||||
* @return <tt>true</tt> if the specified object is equal to this set
|
||||
* @return {@code true} if the specified object is equal to this set
|
||||
*/
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof RegularEnumSet))
|
||||
|
||||
@ -42,20 +42,20 @@ import sun.misc.LRUCache;
|
||||
* A simple text scanner which can parse primitive types and strings using
|
||||
* regular expressions.
|
||||
*
|
||||
* <p>A <code>Scanner</code> breaks its input into tokens using a
|
||||
* <p>A {@code Scanner} breaks its input into tokens using a
|
||||
* delimiter pattern, which by default matches whitespace. The resulting
|
||||
* tokens may then be converted into values of different types using the
|
||||
* various <tt>next</tt> methods.
|
||||
* various {@code next} methods.
|
||||
*
|
||||
* <p>For example, this code allows a user to read a number from
|
||||
* <tt>System.in</tt>:
|
||||
* {@code System.in}:
|
||||
* <blockquote><pre>{@code
|
||||
* Scanner sc = new Scanner(System.in);
|
||||
* int i = sc.nextInt();
|
||||
* }</pre></blockquote>
|
||||
*
|
||||
* <p>As another example, this code allows <code>long</code> types to be
|
||||
* assigned from entries in a file <code>myNumbers</code>:
|
||||
* <p>As another example, this code allows {@code long} types to be
|
||||
* assigned from entries in a file {@code myNumbers}:
|
||||
* <blockquote><pre>{@code
|
||||
* Scanner sc = new Scanner(new File("myNumbers"));
|
||||
* while (sc.hasNextLong()) {
|
||||
@ -106,10 +106,10 @@ import sun.misc.LRUCache;
|
||||
* <p>The {@link #next} and {@link #hasNext} methods and their
|
||||
* primitive-type companion methods (such as {@link #nextInt} and
|
||||
* {@link #hasNextInt}) first skip any input that matches the delimiter
|
||||
* pattern, and then attempt to return the next token. Both <tt>hasNext</tt>
|
||||
* and <tt>next</tt> methods may block waiting for further input. Whether a
|
||||
* <tt>hasNext</tt> method blocks has no connection to whether or not its
|
||||
* associated <tt>next</tt> method will block.
|
||||
* pattern, and then attempt to return the next token. Both {@code hasNext}
|
||||
* and {@code next} methods may block waiting for further input. Whether a
|
||||
* {@code hasNext} method blocks has no connection to whether or not its
|
||||
* associated {@code next} method will block.
|
||||
*
|
||||
* <p> The {@link #findInLine}, {@link #findWithinHorizon}, and {@link #skip}
|
||||
* methods operate independently of the delimiter pattern. These methods will
|
||||
@ -122,32 +122,32 @@ import sun.misc.LRUCache;
|
||||
* retrieved or skipped via some other method.
|
||||
*
|
||||
* <p>Depending upon the type of delimiting pattern, empty tokens may be
|
||||
* returned. For example, the pattern <tt>"\\s+"</tt> will return no empty
|
||||
* returned. For example, the pattern {@code "\\s+"} will return no empty
|
||||
* tokens since it matches multiple instances of the delimiter. The delimiting
|
||||
* pattern <tt>"\\s"</tt> could return empty tokens since it only passes one
|
||||
* pattern {@code "\\s"} could return empty tokens since it only passes one
|
||||
* space at a time.
|
||||
*
|
||||
* <p> A scanner can read text from any object which implements the {@link
|
||||
* java.lang.Readable} interface. If an invocation of the underlying
|
||||
* readable's {@link java.lang.Readable#read} method throws an {@link
|
||||
* java.io.IOException} then the scanner assumes that the end of the input
|
||||
* has been reached. The most recent <tt>IOException</tt> thrown by the
|
||||
* has been reached. The most recent {@code IOException} thrown by the
|
||||
* underlying readable can be retrieved via the {@link #ioException} method.
|
||||
*
|
||||
* <p>When a <code>Scanner</code> is closed, it will close its input source
|
||||
* <p>When a {@code Scanner} is closed, it will close its input source
|
||||
* if the source implements the {@link java.io.Closeable} interface.
|
||||
*
|
||||
* <p>A <code>Scanner</code> is not safe for multithreaded use without
|
||||
* <p>A {@code Scanner} is not safe for multithreaded use without
|
||||
* external synchronization.
|
||||
*
|
||||
* <p>Unless otherwise mentioned, passing a <code>null</code> parameter into
|
||||
* any method of a <code>Scanner</code> will cause a
|
||||
* <code>NullPointerException</code> to be thrown.
|
||||
* <p>Unless otherwise mentioned, passing a {@code null} parameter into
|
||||
* any method of a {@code Scanner} will cause a
|
||||
* {@code NullPointerException} to be thrown.
|
||||
*
|
||||
* <p>A scanner will default to interpreting numbers as decimal unless a
|
||||
* different radix has been set by using the {@link #useRadix} method. The
|
||||
* {@link #reset} method will reset the value of the scanner's radix to
|
||||
* <code>10</code> regardless of whether it was previously changed.
|
||||
* {@code 10} regardless of whether it was previously changed.
|
||||
*
|
||||
* <h3> <a name="localized-numbers">Localized numbers</a> </h3>
|
||||
*
|
||||
@ -162,50 +162,50 @@ import sun.misc.LRUCache;
|
||||
*
|
||||
* <p>The localized formats are defined in terms of the following parameters,
|
||||
* which for a particular locale are taken from that locale's {@link
|
||||
* java.text.DecimalFormat DecimalFormat} object, <tt>df</tt>, and its and
|
||||
* java.text.DecimalFormat DecimalFormat} object, {@code df}, and its and
|
||||
* {@link java.text.DecimalFormatSymbols DecimalFormatSymbols} object,
|
||||
* <tt>dfs</tt>.
|
||||
* {@code dfs}.
|
||||
*
|
||||
* <blockquote><dl>
|
||||
* <dt><i>LocalGroupSeparator </i>
|
||||
* <dd>The character used to separate thousands groups,
|
||||
* <i>i.e.,</i> <tt>dfs.</tt>{@link
|
||||
* <i>i.e.,</i> {@code dfs.}{@link
|
||||
* java.text.DecimalFormatSymbols#getGroupingSeparator
|
||||
* getGroupingSeparator()}
|
||||
* <dt><i>LocalDecimalSeparator </i>
|
||||
* <dd>The character used for the decimal point,
|
||||
* <i>i.e.,</i> <tt>dfs.</tt>{@link
|
||||
* <i>i.e.,</i> {@code dfs.}{@link
|
||||
* java.text.DecimalFormatSymbols#getDecimalSeparator
|
||||
* getDecimalSeparator()}
|
||||
* <dt><i>LocalPositivePrefix </i>
|
||||
* <dd>The string that appears before a positive number (may
|
||||
* be empty), <i>i.e.,</i> <tt>df.</tt>{@link
|
||||
* be empty), <i>i.e.,</i> {@code df.}{@link
|
||||
* java.text.DecimalFormat#getPositivePrefix
|
||||
* getPositivePrefix()}
|
||||
* <dt><i>LocalPositiveSuffix </i>
|
||||
* <dd>The string that appears after a positive number (may be
|
||||
* empty), <i>i.e.,</i> <tt>df.</tt>{@link
|
||||
* empty), <i>i.e.,</i> {@code df.}{@link
|
||||
* java.text.DecimalFormat#getPositiveSuffix
|
||||
* getPositiveSuffix()}
|
||||
* <dt><i>LocalNegativePrefix </i>
|
||||
* <dd>The string that appears before a negative number (may
|
||||
* be empty), <i>i.e.,</i> <tt>df.</tt>{@link
|
||||
* be empty), <i>i.e.,</i> {@code df.}{@link
|
||||
* java.text.DecimalFormat#getNegativePrefix
|
||||
* getNegativePrefix()}
|
||||
* <dt><i>LocalNegativeSuffix </i>
|
||||
* <dd>The string that appears after a negative number (may be
|
||||
* empty), <i>i.e.,</i> <tt>df.</tt>{@link
|
||||
* empty), <i>i.e.,</i> {@code df.}{@link
|
||||
* java.text.DecimalFormat#getNegativeSuffix
|
||||
* getNegativeSuffix()}
|
||||
* <dt><i>LocalNaN </i>
|
||||
* <dd>The string that represents not-a-number for
|
||||
* floating-point values,
|
||||
* <i>i.e.,</i> <tt>dfs.</tt>{@link
|
||||
* <i>i.e.,</i> {@code dfs.}{@link
|
||||
* java.text.DecimalFormatSymbols#getNaN
|
||||
* getNaN()}
|
||||
* <dt><i>LocalInfinity </i>
|
||||
* <dd>The string that represents infinity for floating-point
|
||||
* values, <i>i.e.,</i> <tt>dfs.</tt>{@link
|
||||
* values, <i>i.e.,</i> {@code dfs.}{@link
|
||||
* java.text.DecimalFormatSymbols#getInfinity
|
||||
* getInfinity()}
|
||||
* </dl></blockquote>
|
||||
@ -219,82 +219,82 @@ import sun.misc.LRUCache;
|
||||
* <dl>
|
||||
* <dt><i>NonAsciiDigit</i>:
|
||||
* <dd>A non-ASCII character c for which
|
||||
* {@link java.lang.Character#isDigit Character.isDigit}<tt>(c)</tt>
|
||||
* {@link java.lang.Character#isDigit Character.isDigit}{@code (c)}
|
||||
* returns true
|
||||
*
|
||||
* <dt><i>Non0Digit</i>:
|
||||
* <dd><tt>[1-</tt><i>Rmax</i><tt>] | </tt><i>NonASCIIDigit</i>
|
||||
* <dd>{@code [1-}<i>Rmax</i>{@code ] | }<i>NonASCIIDigit</i>
|
||||
*
|
||||
* <dt><i>Digit</i>:
|
||||
* <dd><tt>[0-</tt><i>Rmax</i><tt>] | </tt><i>NonASCIIDigit</i>
|
||||
* <dd>{@code [0-}<i>Rmax</i>{@code ] | }<i>NonASCIIDigit</i>
|
||||
*
|
||||
* <dt><i>GroupedNumeral</i>:
|
||||
* <dd><tt>( </tt><i>Non0Digit</i>
|
||||
* <i>Digit</i><tt>?
|
||||
* </tt><i>Digit</i><tt>?</tt>
|
||||
* <dd> <tt>( </tt><i>LocalGroupSeparator</i>
|
||||
* <dd><code>( </code><i>Non0Digit</i>
|
||||
* <i>Digit</i>{@code ?
|
||||
* }<i>Digit</i>{@code ?}
|
||||
* <dd> <code>( </code><i>LocalGroupSeparator</i>
|
||||
* <i>Digit</i>
|
||||
* <i>Digit</i>
|
||||
* <i>Digit</i><tt> )+ )</tt>
|
||||
* <i>Digit</i>{@code )+ )}
|
||||
*
|
||||
* <dt><i>Numeral</i>:
|
||||
* <dd><tt>( ( </tt><i>Digit</i><tt>+ )
|
||||
* | </tt><i>GroupedNumeral</i><tt> )</tt>
|
||||
* <dd>{@code ( ( }<i>Digit</i>{@code + )
|
||||
* | }<i>GroupedNumeral</i>{@code )}
|
||||
*
|
||||
* <dt><a name="Integer-regex"><i>Integer</i>:</a>
|
||||
* <dd><tt>( [-+]? ( </tt><i>Numeral</i><tt>
|
||||
* ) )</tt>
|
||||
* <dd><tt>| </tt><i>LocalPositivePrefix</i> <i>Numeral</i>
|
||||
* <dd>{@code ( [-+]? ( }<i>Numeral</i>{@code
|
||||
* ) )}
|
||||
* <dd>{@code | }<i>LocalPositivePrefix</i> <i>Numeral</i>
|
||||
* <i>LocalPositiveSuffix</i>
|
||||
* <dd><tt>| </tt><i>LocalNegativePrefix</i> <i>Numeral</i>
|
||||
* <dd>{@code | }<i>LocalNegativePrefix</i> <i>Numeral</i>
|
||||
* <i>LocalNegativeSuffix</i>
|
||||
*
|
||||
* <dt><i>DecimalNumeral</i>:
|
||||
* <dd><i>Numeral</i>
|
||||
* <dd><tt>| </tt><i>Numeral</i>
|
||||
* <dd>{@code | }<i>Numeral</i>
|
||||
* <i>LocalDecimalSeparator</i>
|
||||
* <i>Digit</i><tt>*</tt>
|
||||
* <dd><tt>| </tt><i>LocalDecimalSeparator</i>
|
||||
* <i>Digit</i><tt>+</tt>
|
||||
* <i>Digit</i>{@code *}
|
||||
* <dd>{@code | }<i>LocalDecimalSeparator</i>
|
||||
* <i>Digit</i>{@code +}
|
||||
*
|
||||
* <dt><i>Exponent</i>:
|
||||
* <dd><tt>( [eE] [+-]? </tt><i>Digit</i><tt>+ )</tt>
|
||||
* <dd>{@code ( [eE] [+-]? }<i>Digit</i>{@code + )}
|
||||
*
|
||||
* <dt><a name="Decimal-regex"><i>Decimal</i>:</a>
|
||||
* <dd><tt>( [-+]? </tt><i>DecimalNumeral</i>
|
||||
* <i>Exponent</i><tt>? )</tt>
|
||||
* <dd><tt>| </tt><i>LocalPositivePrefix</i>
|
||||
* <dd>{@code ( [-+]? }<i>DecimalNumeral</i>
|
||||
* <i>Exponent</i>{@code ? )}
|
||||
* <dd>{@code | }<i>LocalPositivePrefix</i>
|
||||
* <i>DecimalNumeral</i>
|
||||
* <i>LocalPositiveSuffix</i>
|
||||
* <i>Exponent</i><tt>?</tt>
|
||||
* <dd><tt>| </tt><i>LocalNegativePrefix</i>
|
||||
* <i>Exponent</i>{@code ?}
|
||||
* <dd>{@code | }<i>LocalNegativePrefix</i>
|
||||
* <i>DecimalNumeral</i>
|
||||
* <i>LocalNegativeSuffix</i>
|
||||
* <i>Exponent</i><tt>?</tt>
|
||||
* <i>Exponent</i>{@code ?}
|
||||
*
|
||||
* <dt><i>HexFloat</i>:
|
||||
* <dd><tt>[-+]? 0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+
|
||||
* ([pP][-+]?[0-9]+)?</tt>
|
||||
* <dd>{@code [-+]? 0[xX][0-9a-fA-F]*\.[0-9a-fA-F]+
|
||||
* ([pP][-+]?[0-9]+)?}
|
||||
*
|
||||
* <dt><i>NonNumber</i>:
|
||||
* <dd><tt>NaN
|
||||
* | </tt><i>LocalNan</i><tt>
|
||||
* <dd>{@code NaN
|
||||
* | }<i>LocalNan</i>{@code
|
||||
* | Infinity
|
||||
* | </tt><i>LocalInfinity</i>
|
||||
* | }<i>LocalInfinity</i>
|
||||
*
|
||||
* <dt><i>SignedNonNumber</i>:
|
||||
* <dd><tt>( [-+]? </tt><i>NonNumber</i><tt> )</tt>
|
||||
* <dd><tt>| </tt><i>LocalPositivePrefix</i>
|
||||
* <dd>{@code ( [-+]? }<i>NonNumber</i>{@code )}
|
||||
* <dd>{@code | }<i>LocalPositivePrefix</i>
|
||||
* <i>NonNumber</i>
|
||||
* <i>LocalPositiveSuffix</i>
|
||||
* <dd><tt>| </tt><i>LocalNegativePrefix</i>
|
||||
* <dd>{@code | }<i>LocalNegativePrefix</i>
|
||||
* <i>NonNumber</i>
|
||||
* <i>LocalNegativeSuffix</i>
|
||||
*
|
||||
* <dt><a name="Float-regex"><i>Float</i></a>:
|
||||
* <dd><i>Decimal</i>
|
||||
* <tt>| </tt><i>HexFloat</i>
|
||||
* <tt>| </tt><i>SignedNonNumber</i>
|
||||
* {@code | }<i>HexFloat</i>
|
||||
* {@code | }<i>SignedNonNumber</i>
|
||||
*
|
||||
* </dl>
|
||||
* <p>Whitespace is not significant in the above regular expressions.
|
||||
@ -521,7 +521,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
// Constructors
|
||||
|
||||
/**
|
||||
* Constructs a <code>Scanner</code> that returns values scanned
|
||||
* Constructs a {@code Scanner} that returns values scanned
|
||||
* from the specified source delimited by the specified pattern.
|
||||
*
|
||||
* @param source A character source implementing the Readable interface
|
||||
@ -541,7 +541,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified source.
|
||||
*
|
||||
* @param source A character source implementing the {@link Readable}
|
||||
@ -552,7 +552,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified input stream. Bytes from the stream are converted
|
||||
* into characters using the underlying platform's
|
||||
* {@linkplain java.nio.charset.Charset#defaultCharset() default charset}.
|
||||
@ -564,7 +564,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified input stream. Bytes from the stream are converted
|
||||
* into characters using the specified charset.
|
||||
*
|
||||
@ -599,7 +599,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified file. Bytes from the file are converted into
|
||||
* characters using the underlying platform's
|
||||
* {@linkplain java.nio.charset.Charset#defaultCharset() default charset}.
|
||||
@ -612,7 +612,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified file. Bytes from the file are converted into
|
||||
* characters using the specified charset.
|
||||
*
|
||||
@ -650,7 +650,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified file. Bytes from the file are converted into
|
||||
* characters using the underlying platform's
|
||||
* {@linkplain java.nio.charset.Charset#defaultCharset() default charset}.
|
||||
@ -669,7 +669,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified file. Bytes from the file are converted into
|
||||
* characters using the specified charset.
|
||||
*
|
||||
@ -693,7 +693,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified string.
|
||||
*
|
||||
* @param source A string to scan
|
||||
@ -703,7 +703,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified channel. Bytes from the source are converted into
|
||||
* characters using the underlying platform's
|
||||
* {@linkplain java.nio.charset.Charset#defaultCharset() default charset}.
|
||||
@ -720,7 +720,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <code>Scanner</code> that produces values scanned
|
||||
* Constructs a new {@code Scanner} that produces values scanned
|
||||
* from the specified channel. Bytes from the source are converted into
|
||||
* characters using the specified charset.
|
||||
*
|
||||
@ -1077,7 +1077,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
*
|
||||
* <p> If this scanner has not yet been closed then if its underlying
|
||||
* {@linkplain java.lang.Readable readable} also implements the {@link
|
||||
* java.io.Closeable} interface then the readable's <tt>close</tt> method
|
||||
* java.io.Closeable} interface then the readable's {@code close} method
|
||||
* will be invoked. If this scanner is already closed then invoking this
|
||||
* method will have no effect.
|
||||
*
|
||||
@ -1101,9 +1101,9 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>IOException</code> last thrown by this
|
||||
* <code>Scanner</code>'s underlying <code>Readable</code>. This method
|
||||
* returns <code>null</code> if no such exception exists.
|
||||
* Returns the {@code IOException} last thrown by this
|
||||
* {@code Scanner}'s underlying {@code Readable}. This method
|
||||
* returns {@code null} if no such exception exists.
|
||||
*
|
||||
* @return the last exception thrown by this scanner's readable
|
||||
*/
|
||||
@ -1112,7 +1112,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the <code>Pattern</code> this <code>Scanner</code> is currently
|
||||
* Returns the {@code Pattern} this {@code Scanner} is currently
|
||||
* using to match delimiters.
|
||||
*
|
||||
* @return this scanner's delimiting pattern.
|
||||
@ -1134,11 +1134,11 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
|
||||
/**
|
||||
* Sets this scanner's delimiting pattern to a pattern constructed from
|
||||
* the specified <code>String</code>.
|
||||
* the specified {@code String}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
* <tt>useDelimiter(pattern)</tt> behaves in exactly the same way as the
|
||||
* invocation <tt>useDelimiter(Pattern.compile(pattern))</tt>.
|
||||
* {@code useDelimiter(pattern)} behaves in exactly the same way as the
|
||||
* invocation {@code useDelimiter(Pattern.compile(pattern))}.
|
||||
*
|
||||
* <p> Invoking the {@link #reset} method will set the scanner's delimiter
|
||||
* to the <a href= "#default-delimiter">default</a>.
|
||||
@ -1236,12 +1236,12 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* number matching regular expressions; see
|
||||
* <a href= "#localized-numbers">localized numbers</a> above.
|
||||
*
|
||||
* <p>If the radix is less than <code>Character.MIN_RADIX</code>
|
||||
* or greater than <code>Character.MAX_RADIX</code>, then an
|
||||
* <code>IllegalArgumentException</code> is thrown.
|
||||
* <p>If the radix is less than {@code Character.MIN_RADIX}
|
||||
* or greater than {@code Character.MAX_RADIX}, then an
|
||||
* {@code IllegalArgumentException} is thrown.
|
||||
*
|
||||
* <p>Invoking the {@link #reset} method will set the scanner's radix to
|
||||
* <code>10</code>.
|
||||
* {@code 10}.
|
||||
*
|
||||
* @param radix The radix to use when scanning numbers
|
||||
* @return this scanner
|
||||
@ -1271,15 +1271,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
|
||||
/**
|
||||
* Returns the match result of the last scanning operation performed
|
||||
* by this scanner. This method throws <code>IllegalStateException</code>
|
||||
* by this scanner. This method throws {@code IllegalStateException}
|
||||
* if no match has been performed, or if the last match was
|
||||
* not successful.
|
||||
*
|
||||
* <p>The various <code>next</code>methods of <code>Scanner</code>
|
||||
* <p>The various {@code next}methods of {@code Scanner}
|
||||
* make a match result available if they complete without throwing an
|
||||
* exception. For instance, after an invocation of the {@link #nextInt}
|
||||
* method that returned an int, this method returns a
|
||||
* <code>MatchResult</code> for the search of the
|
||||
* {@code MatchResult} for the search of the
|
||||
* <a href="#Integer-regex"><i>Integer</i></a> regular expression
|
||||
* defined above. Similarly the {@link #findInLine},
|
||||
* {@link #findWithinHorizon}, and {@link #skip} methods will make a
|
||||
@ -1295,8 +1295,8 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Returns the string representation of this <code>Scanner</code>. The
|
||||
* string representation of a <code>Scanner</code> contains information
|
||||
* <p>Returns the string representation of this {@code Scanner}. The
|
||||
* string representation of a {@code Scanner} contains information
|
||||
* that may be useful for debugging. The exact format is unspecified.
|
||||
*
|
||||
* @return The string representation of this scanner
|
||||
@ -1347,7 +1347,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* A complete token is preceded and followed by input that matches
|
||||
* the delimiter pattern. This method may block while waiting for input
|
||||
* to scan, even if a previous invocation of {@link #hasNext} returned
|
||||
* <code>true</code>.
|
||||
* {@code true}.
|
||||
*
|
||||
* @return the next token
|
||||
* @throws NoSuchElementException if no more tokens are available
|
||||
@ -1374,7 +1374,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
|
||||
/**
|
||||
* The remove operation is not supported by this implementation of
|
||||
* <code>Iterator</code>.
|
||||
* {@code Iterator}.
|
||||
*
|
||||
* @throws UnsupportedOperationException if this method is invoked.
|
||||
* @see java.util.Iterator
|
||||
@ -1387,9 +1387,9 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* Returns true if the next token matches the pattern constructed from the
|
||||
* specified string. The scanner does not advance past any input.
|
||||
*
|
||||
* <p> An invocation of this method of the form <tt>hasNext(pattern)</tt>
|
||||
* <p> An invocation of this method of the form {@code hasNext(pattern)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
* <tt>hasNext(Pattern.compile(pattern))</tt>.
|
||||
* {@code hasNext(Pattern.compile(pattern))}.
|
||||
*
|
||||
* @param pattern a string specifying the pattern to scan
|
||||
* @return true if and only if this scanner has another token matching
|
||||
@ -1405,9 +1405,9 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* specified string. If the match is successful, the scanner advances
|
||||
* past the input that matched the pattern.
|
||||
*
|
||||
* <p> An invocation of this method of the form <tt>next(pattern)</tt>
|
||||
* <p> An invocation of this method of the form {@code next(pattern)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
* <tt>next(Pattern.compile(pattern))</tt>.
|
||||
* {@code next(Pattern.compile(pattern))}.
|
||||
*
|
||||
* @param pattern a string specifying the pattern to scan
|
||||
* @return the next token
|
||||
@ -1452,7 +1452,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
/**
|
||||
* Returns the next token if it matches the specified pattern. This
|
||||
* method may block while waiting for input to scan, even if a previous
|
||||
* invocation of {@link #hasNext(Pattern)} returned <code>true</code>.
|
||||
* invocation of {@link #hasNext(Pattern)} returned {@code true}.
|
||||
* If the match is successful, the scanner advances past the input that
|
||||
* matched the pattern.
|
||||
*
|
||||
@ -1554,9 +1554,9 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* Attempts to find the next occurrence of a pattern constructed from the
|
||||
* specified string, ignoring delimiters.
|
||||
*
|
||||
* <p>An invocation of this method of the form <tt>findInLine(pattern)</tt>
|
||||
* <p>An invocation of this method of the form {@code findInLine(pattern)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
* <tt>findInLine(Pattern.compile(pattern))</tt>.
|
||||
* {@code findInLine(Pattern.compile(pattern))}.
|
||||
*
|
||||
* @param pattern a string specifying the pattern to search for
|
||||
* @return the text that matched the specified pattern
|
||||
@ -1572,7 +1572,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* scanner advances past the input that matched and returns the string that
|
||||
* matched the pattern.
|
||||
* If no such pattern is detected in the input up to the next line
|
||||
* separator, then <code>null</code> is returned and the scanner's
|
||||
* separator, then {@code null} is returned and the scanner's
|
||||
* position is unchanged. This method may block waiting for input that
|
||||
* matches the pattern.
|
||||
*
|
||||
@ -1621,9 +1621,9 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* specified string, ignoring delimiters.
|
||||
*
|
||||
* <p>An invocation of this method of the form
|
||||
* <tt>findWithinHorizon(pattern)</tt> behaves in exactly the same way as
|
||||
* {@code findWithinHorizon(pattern)} behaves in exactly the same way as
|
||||
* the invocation
|
||||
* <tt>findWithinHorizon(Pattern.compile(pattern, horizon))</tt>.
|
||||
* {@code findWithinHorizon(Pattern.compile(pattern, horizon))}.
|
||||
*
|
||||
* @param pattern a string specifying the pattern to search for
|
||||
* @param horizon the search horizon
|
||||
@ -1645,14 +1645,14 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* null is returned and the scanner's position remains unchanged. This
|
||||
* method may block waiting for input that matches the pattern.
|
||||
*
|
||||
* <p>A scanner will never search more than <code>horizon</code> code
|
||||
* <p>A scanner will never search more than {@code horizon} code
|
||||
* points beyond its current position. Note that a match may be clipped
|
||||
* by the horizon; that is, an arbitrary match result may have been
|
||||
* different if the horizon had been larger. The scanner treats the
|
||||
* horizon as a transparent, non-anchoring bound (see {@link
|
||||
* Matcher#useTransparentBounds} and {@link Matcher#useAnchoringBounds}).
|
||||
*
|
||||
* <p>If horizon is <code>0</code>, then the horizon is ignored and
|
||||
* <p>If horizon is {@code 0}, then the horizon is ignored and
|
||||
* this method continues to search through the input looking for the
|
||||
* specified pattern without bound. In this case it may buffer all of
|
||||
* the input searching for the pattern.
|
||||
@ -1696,7 +1696,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
*
|
||||
* <p>If a match to the specified pattern is not found at the
|
||||
* current position, then no input is skipped and a
|
||||
* <tt>NoSuchElementException</tt> is thrown.
|
||||
* {@code NoSuchElementException} is thrown.
|
||||
*
|
||||
* <p>Since this method seeks to match the specified pattern starting at
|
||||
* the scanner's current position, patterns that can match a lot of
|
||||
@ -1704,8 +1704,8 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* amount of input.
|
||||
*
|
||||
* <p>Note that it is possible to skip something without risking a
|
||||
* <code>NoSuchElementException</code> by using a pattern that can
|
||||
* match nothing, e.g., <code>sc.skip("[ \t]*")</code>.
|
||||
* {@code NoSuchElementException} by using a pattern that can
|
||||
* match nothing, e.g., {@code sc.skip("[ \t]*")}.
|
||||
*
|
||||
* @param pattern a string specifying the pattern to skip over
|
||||
* @return this scanner
|
||||
@ -1737,9 +1737,9 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* Skips input that matches a pattern constructed from the specified
|
||||
* string.
|
||||
*
|
||||
* <p> An invocation of this method of the form <tt>skip(pattern)</tt>
|
||||
* <p> An invocation of this method of the form {@code skip(pattern)}
|
||||
* behaves in exactly the same way as the invocation
|
||||
* <tt>skip(Pattern.compile(pattern))</tt>.
|
||||
* {@code skip(Pattern.compile(pattern))}.
|
||||
*
|
||||
* @param pattern a string specifying the pattern to skip over
|
||||
* @return this scanner
|
||||
@ -1767,7 +1767,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
|
||||
/**
|
||||
* Scans the next token of the input into a boolean value and returns
|
||||
* that value. This method will throw <code>InputMismatchException</code>
|
||||
* that value. This method will throw {@code InputMismatchException}
|
||||
* if the next token cannot be translated into a valid boolean value.
|
||||
* If the match is successful, the scanner advances past the input that
|
||||
* matched.
|
||||
@ -1822,14 +1822,14 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as a <tt>byte</tt>.
|
||||
* Scans the next token of the input as a {@code byte}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
* <tt>nextByte()</tt> behaves in exactly the same way as the
|
||||
* invocation <tt>nextByte(radix)</tt>, where <code>radix</code>
|
||||
* {@code nextByte()} behaves in exactly the same way as the
|
||||
* invocation {@code nextByte(radix)}, where {@code radix}
|
||||
* is the default radix of this scanner.
|
||||
*
|
||||
* @return the <tt>byte</tt> scanned from the input
|
||||
* @return the {@code byte} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -1841,15 +1841,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as a <tt>byte</tt>.
|
||||
* This method will throw <code>InputMismatchException</code>
|
||||
* Scans the next token of the input as a {@code byte}.
|
||||
* This method will throw {@code InputMismatchException}
|
||||
* if the next token cannot be translated into a valid byte value as
|
||||
* described below. If the translation is successful, the scanner advances
|
||||
* past the input that matched.
|
||||
*
|
||||
* <p> If the next token matches the <a
|
||||
* href="#Integer-regex"><i>Integer</i></a> regular expression defined
|
||||
* above then the token is converted into a <tt>byte</tt> value as if by
|
||||
* above then the token is converted into a {@code byte} value as if by
|
||||
* removing all locale specific prefixes, group separators, and locale
|
||||
* specific suffixes, then mapping non-ASCII digits into ASCII
|
||||
* digits via {@link Character#digit Character.digit}, prepending a
|
||||
@ -1859,7 +1859,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* specified radix.
|
||||
*
|
||||
* @param radix the radix used to interpret the token as a byte value
|
||||
* @return the <tt>byte</tt> scanned from the input
|
||||
* @return the {@code byte} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -1928,14 +1928,14 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as a <tt>short</tt>.
|
||||
* Scans the next token of the input as a {@code short}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
* <tt>nextShort()</tt> behaves in exactly the same way as the
|
||||
* invocation <tt>nextShort(radix)</tt>, where <code>radix</code>
|
||||
* {@code nextShort()} behaves in exactly the same way as the
|
||||
* invocation {@code nextShort(radix)}, where {@code radix}
|
||||
* is the default radix of this scanner.
|
||||
*
|
||||
* @return the <tt>short</tt> scanned from the input
|
||||
* @return the {@code short} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -1947,15 +1947,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as a <tt>short</tt>.
|
||||
* This method will throw <code>InputMismatchException</code>
|
||||
* Scans the next token of the input as a {@code short}.
|
||||
* This method will throw {@code InputMismatchException}
|
||||
* if the next token cannot be translated into a valid short value as
|
||||
* described below. If the translation is successful, the scanner advances
|
||||
* past the input that matched.
|
||||
*
|
||||
* <p> If the next token matches the <a
|
||||
* href="#Integer-regex"><i>Integer</i></a> regular expression defined
|
||||
* above then the token is converted into a <tt>short</tt> value as if by
|
||||
* above then the token is converted into a {@code short} value as if by
|
||||
* removing all locale specific prefixes, group separators, and locale
|
||||
* specific suffixes, then mapping non-ASCII digits into ASCII
|
||||
* digits via {@link Character#digit Character.digit}, prepending a
|
||||
@ -1965,7 +1965,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* specified radix.
|
||||
*
|
||||
* @param radix the radix used to interpret the token as a short value
|
||||
* @return the <tt>short</tt> scanned from the input
|
||||
* @return the {@code short} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2058,14 +2058,14 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as an <tt>int</tt>.
|
||||
* Scans the next token of the input as an {@code int}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
* <tt>nextInt()</tt> behaves in exactly the same way as the
|
||||
* invocation <tt>nextInt(radix)</tt>, where <code>radix</code>
|
||||
* {@code nextInt()} behaves in exactly the same way as the
|
||||
* invocation {@code nextInt(radix)}, where {@code radix}
|
||||
* is the default radix of this scanner.
|
||||
*
|
||||
* @return the <tt>int</tt> scanned from the input
|
||||
* @return the {@code int} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2077,15 +2077,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as an <tt>int</tt>.
|
||||
* This method will throw <code>InputMismatchException</code>
|
||||
* Scans the next token of the input as an {@code int}.
|
||||
* This method will throw {@code InputMismatchException}
|
||||
* if the next token cannot be translated into a valid int value as
|
||||
* described below. If the translation is successful, the scanner advances
|
||||
* past the input that matched.
|
||||
*
|
||||
* <p> If the next token matches the <a
|
||||
* href="#Integer-regex"><i>Integer</i></a> regular expression defined
|
||||
* above then the token is converted into an <tt>int</tt> value as if by
|
||||
* above then the token is converted into an {@code int} value as if by
|
||||
* removing all locale specific prefixes, group separators, and locale
|
||||
* specific suffixes, then mapping non-ASCII digits into ASCII
|
||||
* digits via {@link Character#digit Character.digit}, prepending a
|
||||
@ -2095,7 +2095,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* specified radix.
|
||||
*
|
||||
* @param radix the radix used to interpret the token as an int value
|
||||
* @return the <tt>int</tt> scanned from the input
|
||||
* @return the {@code int} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2164,14 +2164,14 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as a <tt>long</tt>.
|
||||
* Scans the next token of the input as a {@code long}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
* <tt>nextLong()</tt> behaves in exactly the same way as the
|
||||
* invocation <tt>nextLong(radix)</tt>, where <code>radix</code>
|
||||
* {@code nextLong()} behaves in exactly the same way as the
|
||||
* invocation {@code nextLong(radix)}, where {@code radix}
|
||||
* is the default radix of this scanner.
|
||||
*
|
||||
* @return the <tt>long</tt> scanned from the input
|
||||
* @return the {@code long} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2183,15 +2183,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as a <tt>long</tt>.
|
||||
* This method will throw <code>InputMismatchException</code>
|
||||
* Scans the next token of the input as a {@code long}.
|
||||
* This method will throw {@code InputMismatchException}
|
||||
* if the next token cannot be translated into a valid long value as
|
||||
* described below. If the translation is successful, the scanner advances
|
||||
* past the input that matched.
|
||||
*
|
||||
* <p> If the next token matches the <a
|
||||
* href="#Integer-regex"><i>Integer</i></a> regular expression defined
|
||||
* above then the token is converted into a <tt>long</tt> value as if by
|
||||
* above then the token is converted into a {@code long} value as if by
|
||||
* removing all locale specific prefixes, group separators, and locale
|
||||
* specific suffixes, then mapping non-ASCII digits into ASCII
|
||||
* digits via {@link Character#digit Character.digit}, prepending a
|
||||
@ -2201,7 +2201,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* specified radix.
|
||||
*
|
||||
* @param radix the radix used to interpret the token as an int value
|
||||
* @return the <tt>long</tt> scanned from the input
|
||||
* @return the {@code long} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2306,15 +2306,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as a <tt>float</tt>.
|
||||
* This method will throw <code>InputMismatchException</code>
|
||||
* Scans the next token of the input as a {@code float}.
|
||||
* This method will throw {@code InputMismatchException}
|
||||
* if the next token cannot be translated into a valid float value as
|
||||
* described below. If the translation is successful, the scanner advances
|
||||
* past the input that matched.
|
||||
*
|
||||
* <p> If the next token matches the <a
|
||||
* href="#Float-regex"><i>Float</i></a> regular expression defined above
|
||||
* then the token is converted into a <tt>float</tt> value as if by
|
||||
* then the token is converted into a {@code float} value as if by
|
||||
* removing all locale specific prefixes, group separators, and locale
|
||||
* specific suffixes, then mapping non-ASCII digits into ASCII
|
||||
* digits via {@link Character#digit Character.digit}, prepending a
|
||||
@ -2325,7 +2325,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* is passed to {@link Float#parseFloat(String) Float.parseFloat} as
|
||||
* appropriate.
|
||||
*
|
||||
* @return the <tt>float</tt> scanned from the input
|
||||
* @return the {@code float} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Float</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2373,15 +2373,15 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the next token of the input as a <tt>double</tt>.
|
||||
* This method will throw <code>InputMismatchException</code>
|
||||
* Scans the next token of the input as a {@code double}.
|
||||
* This method will throw {@code InputMismatchException}
|
||||
* if the next token cannot be translated into a valid double value.
|
||||
* If the translation is successful, the scanner advances past the input
|
||||
* that matched.
|
||||
*
|
||||
* <p> If the next token matches the <a
|
||||
* href="#Float-regex"><i>Float</i></a> regular expression defined above
|
||||
* then the token is converted into a <tt>double</tt> value as if by
|
||||
* then the token is converted into a {@code double} value as if by
|
||||
* removing all locale specific prefixes, group separators, and locale
|
||||
* specific suffixes, then mapping non-ASCII digits into ASCII
|
||||
* digits via {@link Character#digit Character.digit}, prepending a
|
||||
@ -2392,7 +2392,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* is passed to {@link Double#parseDouble(String) Double.parseDouble} as
|
||||
* appropriate.
|
||||
*
|
||||
* @return the <tt>double</tt> scanned from the input
|
||||
* @return the {@code double} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Float</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2421,12 +2421,12 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
|
||||
/**
|
||||
* Returns true if the next token in this scanner's input can be
|
||||
* interpreted as a <code>BigInteger</code> in the default radix using the
|
||||
* interpreted as a {@code BigInteger} in the default radix using the
|
||||
* {@link #nextBigInteger} method. The scanner does not advance past any
|
||||
* input.
|
||||
*
|
||||
* @return true if and only if this scanner's next token is a valid
|
||||
* <code>BigInteger</code>
|
||||
* {@code BigInteger}
|
||||
* @throws IllegalStateException if this scanner is closed
|
||||
*/
|
||||
public boolean hasNextBigInteger() {
|
||||
@ -2435,13 +2435,13 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
|
||||
/**
|
||||
* Returns true if the next token in this scanner's input can be
|
||||
* interpreted as a <code>BigInteger</code> in the specified radix using
|
||||
* interpreted as a {@code BigInteger} in the specified radix using
|
||||
* the {@link #nextBigInteger} method. The scanner does not advance past
|
||||
* any input.
|
||||
*
|
||||
* @param radix the radix used to interpret the token as an integer
|
||||
* @return true if and only if this scanner's next token is a valid
|
||||
* <code>BigInteger</code>
|
||||
* {@code BigInteger}
|
||||
* @throws IllegalStateException if this scanner is closed
|
||||
*/
|
||||
public boolean hasNextBigInteger(int radix) {
|
||||
@ -2465,11 +2465,11 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* BigInteger}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
* <tt>nextBigInteger()</tt> behaves in exactly the same way as the
|
||||
* invocation <tt>nextBigInteger(radix)</tt>, where <code>radix</code>
|
||||
* {@code nextBigInteger()} behaves in exactly the same way as the
|
||||
* invocation {@code nextBigInteger(radix)}, where {@code radix}
|
||||
* is the default radix of this scanner.
|
||||
*
|
||||
* @return the <tt>BigInteger</tt> scanned from the input
|
||||
* @return the {@code BigInteger} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2486,7 +2486,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
*
|
||||
* <p> If the next token matches the <a
|
||||
* href="#Integer-regex"><i>Integer</i></a> regular expression defined
|
||||
* above then the token is converted into a <tt>BigInteger</tt> value as if
|
||||
* above then the token is converted into a {@code BigInteger} value as if
|
||||
* by removing all group separators, mapping non-ASCII digits into ASCII
|
||||
* digits via the {@link Character#digit Character.digit}, and passing the
|
||||
* resulting string to the {@link
|
||||
@ -2494,7 +2494,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* BigInteger(String, int)} constructor with the specified radix.
|
||||
*
|
||||
* @param radix the radix used to interpret the token
|
||||
* @return the <tt>BigInteger</tt> scanned from the input
|
||||
* @return the {@code BigInteger} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Integer</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2525,12 +2525,12 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
|
||||
/**
|
||||
* Returns true if the next token in this scanner's input can be
|
||||
* interpreted as a <code>BigDecimal</code> using the
|
||||
* interpreted as a {@code BigDecimal} using the
|
||||
* {@link #nextBigDecimal} method. The scanner does not advance past any
|
||||
* input.
|
||||
*
|
||||
* @return true if and only if this scanner's next token is a valid
|
||||
* <code>BigDecimal</code>
|
||||
* {@code BigDecimal}
|
||||
* @throws IllegalStateException if this scanner is closed
|
||||
*/
|
||||
public boolean hasNextBigDecimal() {
|
||||
@ -2553,14 +2553,14 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
*
|
||||
* <p> If the next token matches the <a
|
||||
* href="#Decimal-regex"><i>Decimal</i></a> regular expression defined
|
||||
* above then the token is converted into a <tt>BigDecimal</tt> value as if
|
||||
* above then the token is converted into a {@code BigDecimal} value as if
|
||||
* by removing all group separators, mapping non-ASCII digits into ASCII
|
||||
* digits via the {@link Character#digit Character.digit}, and passing the
|
||||
* resulting string to the {@link
|
||||
* java.math.BigDecimal#BigDecimal(java.lang.String) BigDecimal(String)}
|
||||
* constructor.
|
||||
*
|
||||
* @return the <tt>BigDecimal</tt> scanned from the input
|
||||
* @return the {@code BigDecimal} scanned from the input
|
||||
* @throws InputMismatchException
|
||||
* if the next token does not match the <i>Decimal</i>
|
||||
* regular expression, or is out of range
|
||||
@ -2594,7 +2594,7 @@ public final class Scanner implements Iterator<String>, Closeable {
|
||||
* #useDelimiter}, {@link #useLocale}, or {@link #useRadix}.
|
||||
*
|
||||
* <p> An invocation of this method of the form
|
||||
* <tt>scanner.reset()</tt> behaves in exactly the same way as the
|
||||
* {@code scanner.reset()} behaves in exactly the same way as the
|
||||
* invocation
|
||||
*
|
||||
* <blockquote><pre>{@code
|
||||
|
||||
@ -65,7 +65,7 @@ public class ServiceConfigurationError
|
||||
/**
|
||||
* Constructs a new instance with the specified message.
|
||||
*
|
||||
* @param msg The message, or <tt>null</tt> if there is no message
|
||||
* @param msg The message, or {@code null} if there is no message
|
||||
*
|
||||
*/
|
||||
public ServiceConfigurationError(String msg) {
|
||||
@ -75,9 +75,9 @@ public class ServiceConfigurationError
|
||||
/**
|
||||
* Constructs a new instance with the specified message and cause.
|
||||
*
|
||||
* @param msg The message, or <tt>null</tt> if there is no message
|
||||
* @param msg The message, or {@code null} if there is no message
|
||||
*
|
||||
* @param cause The cause, or <tt>null</tt> if the cause is nonexistent
|
||||
* @param cause The cause, or {@code null} if the cause is nonexistent
|
||||
* or unknown
|
||||
*/
|
||||
public ServiceConfigurationError(String msg, Throwable cause) {
|
||||
|
||||
@ -27,16 +27,16 @@ package java.util;
|
||||
|
||||
/**
|
||||
* A collection that contains no duplicate elements. More formally, sets
|
||||
* contain no pair of elements <code>e1</code> and <code>e2</code> such that
|
||||
* <code>e1.equals(e2)</code>, and at most one null element. As implied by
|
||||
* contain no pair of elements {@code e1} and {@code e2} such that
|
||||
* {@code e1.equals(e2)}, and at most one null element. As implied by
|
||||
* its name, this interface models the mathematical <i>set</i> abstraction.
|
||||
*
|
||||
* <p>The <tt>Set</tt> interface places additional stipulations, beyond those
|
||||
* inherited from the <tt>Collection</tt> interface, on the contracts of all
|
||||
* constructors and on the contracts of the <tt>add</tt>, <tt>equals</tt> and
|
||||
* <tt>hashCode</tt> methods. Declarations for other inherited methods are
|
||||
* <p>The {@code Set} interface places additional stipulations, beyond those
|
||||
* inherited from the {@code Collection} interface, on the contracts of all
|
||||
* constructors and on the contracts of the {@code add}, {@code equals} and
|
||||
* {@code hashCode} methods. Declarations for other inherited methods are
|
||||
* also included here for convenience. (The specifications accompanying these
|
||||
* declarations have been tailored to the <tt>Set</tt> interface, but they do
|
||||
* declarations have been tailored to the {@code Set} interface, but they do
|
||||
* not contain any additional stipulations.)
|
||||
*
|
||||
* <p>The additional stipulation on constructors is, not surprisingly,
|
||||
@ -45,7 +45,7 @@ package java.util;
|
||||
*
|
||||
* <p>Note: Great care must be exercised if mutable objects are used as set
|
||||
* elements. The behavior of a set is not specified if the value of an object
|
||||
* is changed in a manner that affects <tt>equals</tt> comparisons while the
|
||||
* is changed in a manner that affects {@code equals} comparisons while the
|
||||
* object is an element in the set. A special case of this prohibition is
|
||||
* that it is not permissible for a set to contain itself as an element.
|
||||
*
|
||||
@ -53,7 +53,7 @@ package java.util;
|
||||
* they may contain. For example, some implementations prohibit null elements,
|
||||
* and some have restrictions on the types of their elements. Attempting to
|
||||
* add an ineligible element throws an unchecked exception, typically
|
||||
* <tt>NullPointerException</tt> or <tt>ClassCastException</tt>. Attempting
|
||||
* {@code NullPointerException} or {@code ClassCastException}. Attempting
|
||||
* to query the presence of an ineligible element may throw an exception,
|
||||
* or it may simply return false; some implementations will exhibit the former
|
||||
* behavior and some will exhibit the latter. More generally, attempting an
|
||||
@ -87,28 +87,28 @@ public interface Set<E> extends Collection<E> {
|
||||
|
||||
/**
|
||||
* Returns the number of elements in this set (its cardinality). If this
|
||||
* set contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
|
||||
* <tt>Integer.MAX_VALUE</tt>.
|
||||
* set contains more than {@code Integer.MAX_VALUE} elements, returns
|
||||
* {@code Integer.MAX_VALUE}.
|
||||
*
|
||||
* @return the number of elements in this set (its cardinality)
|
||||
*/
|
||||
int size();
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains no elements.
|
||||
* Returns {@code true} if this set contains no elements.
|
||||
*
|
||||
* @return <tt>true</tt> if this set contains no elements
|
||||
* @return {@code true} if this set contains no elements
|
||||
*/
|
||||
boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains the specified element.
|
||||
* More formally, returns <tt>true</tt> if and only if this set
|
||||
* contains an element <tt>e</tt> such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>.
|
||||
* Returns {@code true} if this set contains the specified element.
|
||||
* More formally, returns {@code true} if and only if this set
|
||||
* contains an element {@code e} such that
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param o element whose presence in this set is to be tested
|
||||
* @return <tt>true</tt> if this set contains the specified element
|
||||
* @return {@code true} if this set contains the specified element
|
||||
* @throws ClassCastException if the type of the specified element
|
||||
* is incompatible with this set
|
||||
* (<a href="Collection.html#optional-restrictions">optional</a>)
|
||||
@ -155,7 +155,7 @@ public interface Set<E> extends Collection<E> {
|
||||
* <p>If this set fits in the specified array with room to spare
|
||||
* (i.e., the array has more elements than this set), the element in
|
||||
* the array immediately following the end of the set is set to
|
||||
* <tt>null</tt>. (This is useful in determining the length of this
|
||||
* {@code null}. (This is useful in determining the length of this
|
||||
* set <i>only</i> if the caller knows that this set does not contain
|
||||
* any null elements.)
|
||||
*
|
||||
@ -168,15 +168,15 @@ public interface Set<E> extends Collection<E> {
|
||||
* precise control over the runtime type of the output array, and may,
|
||||
* under certain circumstances, be used to save allocation costs.
|
||||
*
|
||||
* <p>Suppose <tt>x</tt> is a set known to contain only strings.
|
||||
* <p>Suppose {@code x} is a set known to contain only strings.
|
||||
* The following code can be used to dump the set into a newly allocated
|
||||
* array of <tt>String</tt>:
|
||||
* array of {@code String}:
|
||||
*
|
||||
* <pre>
|
||||
* String[] y = x.toArray(new String[0]);</pre>
|
||||
*
|
||||
* Note that <tt>toArray(new Object[0])</tt> is identical in function to
|
||||
* <tt>toArray()</tt>.
|
||||
* Note that {@code toArray(new Object[0])} is identical in function to
|
||||
* {@code toArray()}.
|
||||
*
|
||||
* @param a the array into which the elements of this set are to be
|
||||
* stored, if it is big enough; otherwise, a new array of the same
|
||||
@ -195,25 +195,25 @@ public interface Set<E> extends Collection<E> {
|
||||
/**
|
||||
* Adds the specified element to this set if it is not already present
|
||||
* (optional operation). More formally, adds the specified element
|
||||
* <tt>e</tt> to this set if the set contains no element <tt>e2</tt>
|
||||
* {@code e} to this set if the set contains no element {@code e2}
|
||||
* such that
|
||||
* <tt>(e==null ? e2==null : e.equals(e2))</tt>.
|
||||
* {@code Objects.equals(e, e2)}.
|
||||
* If this set already contains the element, the call leaves the set
|
||||
* unchanged and returns <tt>false</tt>. In combination with the
|
||||
* unchanged and returns {@code false}. In combination with the
|
||||
* restriction on constructors, this ensures that sets never contain
|
||||
* duplicate elements.
|
||||
*
|
||||
* <p>The stipulation above does not imply that sets must accept all
|
||||
* elements; sets may refuse to add any particular element, including
|
||||
* <tt>null</tt>, and throw an exception, as described in the
|
||||
* {@code null}, and throw an exception, as described in the
|
||||
* specification for {@link Collection#add Collection.add}.
|
||||
* Individual set implementations should clearly document any
|
||||
* restrictions on the elements that they may contain.
|
||||
*
|
||||
* @param e element to be added to this set
|
||||
* @return <tt>true</tt> if this set did not already contain the specified
|
||||
* @return {@code true} if this set did not already contain the specified
|
||||
* element
|
||||
* @throws UnsupportedOperationException if the <tt>add</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code add} operation
|
||||
* is not supported by this set
|
||||
* @throws ClassCastException if the class of the specified element
|
||||
* prevents it from being added to this set
|
||||
@ -227,23 +227,23 @@ public interface Set<E> extends Collection<E> {
|
||||
|
||||
/**
|
||||
* Removes the specified element from this set if it is present
|
||||
* (optional operation). More formally, removes an element <tt>e</tt>
|
||||
* (optional operation). More formally, removes an element {@code e}
|
||||
* such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>, if
|
||||
* this set contains such an element. Returns <tt>true</tt> if this set
|
||||
* {@code Objects.equals(o, e)}, if
|
||||
* this set contains such an element. Returns {@code true} if this set
|
||||
* contained the element (or equivalently, if this set changed as a
|
||||
* result of the call). (This set will not contain the element once the
|
||||
* call returns.)
|
||||
*
|
||||
* @param o object to be removed from this set, if present
|
||||
* @return <tt>true</tt> if this set contained the specified element
|
||||
* @return {@code true} if this set contained the specified element
|
||||
* @throws ClassCastException if the type of the specified element
|
||||
* is incompatible with this set
|
||||
* (<a href="Collection.html#optional-restrictions">optional</a>)
|
||||
* @throws NullPointerException if the specified element is null and this
|
||||
* set does not permit null elements
|
||||
* (<a href="Collection.html#optional-restrictions">optional</a>)
|
||||
* @throws UnsupportedOperationException if the <tt>remove</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code remove} operation
|
||||
* is not supported by this set
|
||||
*/
|
||||
boolean remove(Object o);
|
||||
@ -252,12 +252,12 @@ public interface Set<E> extends Collection<E> {
|
||||
// Bulk Operations
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this set contains all of the elements of the
|
||||
* Returns {@code true} if this set contains all of the elements of the
|
||||
* specified collection. If the specified collection is also a set, this
|
||||
* method returns <tt>true</tt> if it is a <i>subset</i> of this set.
|
||||
* method returns {@code true} if it is a <i>subset</i> of this set.
|
||||
*
|
||||
* @param c collection to be checked for containment in this set
|
||||
* @return <tt>true</tt> if this set contains all of the elements of the
|
||||
* @return {@code true} if this set contains all of the elements of the
|
||||
* specified collection
|
||||
* @throws ClassCastException if the types of one or more elements
|
||||
* in the specified collection are incompatible with this
|
||||
@ -275,15 +275,15 @@ public interface Set<E> extends Collection<E> {
|
||||
/**
|
||||
* Adds all of the elements in the specified collection to this set if
|
||||
* they're not already present (optional operation). If the specified
|
||||
* collection is also a set, the <tt>addAll</tt> operation effectively
|
||||
* collection is also a set, the {@code addAll} operation effectively
|
||||
* modifies this set so that its value is the <i>union</i> of the two
|
||||
* sets. The behavior of this operation is undefined if the specified
|
||||
* collection is modified while the operation is in progress.
|
||||
*
|
||||
* @param c collection containing elements to be added to this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
*
|
||||
* @throws UnsupportedOperationException if the <tt>addAll</tt> operation
|
||||
* @throws UnsupportedOperationException if the {@code addAll} operation
|
||||
* is not supported by this set
|
||||
* @throws ClassCastException if the class of an element of the
|
||||
* specified collection prevents it from being added to this set
|
||||
@ -305,8 +305,8 @@ public interface Set<E> extends Collection<E> {
|
||||
* <i>intersection</i> of the two sets.
|
||||
*
|
||||
* @param c collection containing elements to be retained in this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>retainAll</tt> operation
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code retainAll} operation
|
||||
* is not supported by this set
|
||||
* @throws ClassCastException if the class of an element of this set
|
||||
* is incompatible with the specified collection
|
||||
@ -327,8 +327,8 @@ public interface Set<E> extends Collection<E> {
|
||||
* the two sets.
|
||||
*
|
||||
* @param c collection containing elements to be removed from this set
|
||||
* @return <tt>true</tt> if this set changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the <tt>removeAll</tt> operation
|
||||
* @return {@code true} if this set changed as a result of the call
|
||||
* @throws UnsupportedOperationException if the {@code removeAll} operation
|
||||
* is not supported by this set
|
||||
* @throws ClassCastException if the class of an element of this set
|
||||
* is incompatible with the specified collection
|
||||
@ -346,7 +346,7 @@ public interface Set<E> extends Collection<E> {
|
||||
* Removes all of the elements from this set (optional operation).
|
||||
* The set will be empty after this call returns.
|
||||
*
|
||||
* @throws UnsupportedOperationException if the <tt>clear</tt> method
|
||||
* @throws UnsupportedOperationException if the {@code clear} method
|
||||
* is not supported by this set
|
||||
*/
|
||||
void clear();
|
||||
@ -356,7 +356,7 @@ public interface Set<E> extends Collection<E> {
|
||||
|
||||
/**
|
||||
* Compares the specified object with this set for equality. Returns
|
||||
* <tt>true</tt> if the specified object is also a set, the two sets
|
||||
* {@code true} if the specified object is also a set, the two sets
|
||||
* have the same size, and every member of the specified set is
|
||||
* contained in this set (or equivalently, every member of this set is
|
||||
* contained in the specified set). This definition ensures that the
|
||||
@ -364,17 +364,17 @@ public interface Set<E> extends Collection<E> {
|
||||
* set interface.
|
||||
*
|
||||
* @param o object to be compared for equality with this set
|
||||
* @return <tt>true</tt> if the specified object is equal to this set
|
||||
* @return {@code true} if the specified object is equal to this set
|
||||
*/
|
||||
boolean equals(Object o);
|
||||
|
||||
/**
|
||||
* Returns the hash code value for this set. The hash code of a set is
|
||||
* defined to be the sum of the hash codes of the elements in the set,
|
||||
* where the hash code of a <tt>null</tt> element is defined to be zero.
|
||||
* This ensures that <tt>s1.equals(s2)</tt> implies that
|
||||
* <tt>s1.hashCode()==s2.hashCode()</tt> for any two sets <tt>s1</tt>
|
||||
* and <tt>s2</tt>, as required by the general contract of
|
||||
* where the hash code of a {@code null} element is defined to be zero.
|
||||
* This ensures that {@code s1.equals(s2)} implies that
|
||||
* {@code s1.hashCode()==s2.hashCode()} for any two sets {@code s1}
|
||||
* and {@code s2}, as required by the general contract of
|
||||
* {@link Object#hashCode}.
|
||||
*
|
||||
* @return the hash code value for this set
|
||||
|
||||
@ -34,38 +34,38 @@ package java.util;
|
||||
* to take advantage of the ordering. (This interface is the set
|
||||
* analogue of {@link SortedMap}.)
|
||||
*
|
||||
* <p>All elements inserted into a sorted set must implement the <tt>Comparable</tt>
|
||||
* <p>All elements inserted into a sorted set must implement the {@code Comparable}
|
||||
* interface (or be accepted by the specified comparator). Furthermore, all
|
||||
* such elements must be <i>mutually comparable</i>: <tt>e1.compareTo(e2)</tt>
|
||||
* (or <tt>comparator.compare(e1, e2)</tt>) must not throw a
|
||||
* <tt>ClassCastException</tt> for any elements <tt>e1</tt> and <tt>e2</tt> in
|
||||
* such elements must be <i>mutually comparable</i>: {@code e1.compareTo(e2)}
|
||||
* (or {@code comparator.compare(e1, e2)}) must not throw a
|
||||
* {@code ClassCastException} for any elements {@code e1} and {@code e2} in
|
||||
* the sorted set. Attempts to violate this restriction will cause the
|
||||
* offending method or constructor invocation to throw a
|
||||
* <tt>ClassCastException</tt>.
|
||||
* {@code ClassCastException}.
|
||||
*
|
||||
* <p>Note that the ordering maintained by a sorted set (whether or not an
|
||||
* explicit comparator is provided) must be <i>consistent with equals</i> if
|
||||
* the sorted set is to correctly implement the <tt>Set</tt> interface. (See
|
||||
* the <tt>Comparable</tt> interface or <tt>Comparator</tt> interface for a
|
||||
* the sorted set is to correctly implement the {@code Set} interface. (See
|
||||
* the {@code Comparable} interface or {@code Comparator} interface for a
|
||||
* precise definition of <i>consistent with equals</i>.) This is so because
|
||||
* the <tt>Set</tt> interface is defined in terms of the <tt>equals</tt>
|
||||
* the {@code Set} interface is defined in terms of the {@code equals}
|
||||
* operation, but a sorted set performs all element comparisons using its
|
||||
* <tt>compareTo</tt> (or <tt>compare</tt>) method, so two elements that are
|
||||
* {@code compareTo} (or {@code compare}) method, so two elements that are
|
||||
* deemed equal by this method are, from the standpoint of the sorted set,
|
||||
* equal. The behavior of a sorted set <i>is</i> well-defined even if its
|
||||
* ordering is inconsistent with equals; it just fails to obey the general
|
||||
* contract of the <tt>Set</tt> interface.
|
||||
* contract of the {@code Set} interface.
|
||||
*
|
||||
* <p>All general-purpose sorted set implementation classes should
|
||||
* provide four "standard" constructors: 1) A void (no arguments)
|
||||
* constructor, which creates an empty sorted set sorted according to
|
||||
* the natural ordering of its elements. 2) A constructor with a
|
||||
* single argument of type <tt>Comparator</tt>, which creates an empty
|
||||
* single argument of type {@code Comparator}, which creates an empty
|
||||
* sorted set sorted according to the specified comparator. 3) A
|
||||
* constructor with a single argument of type <tt>Collection</tt>,
|
||||
* constructor with a single argument of type {@code Collection},
|
||||
* which creates a new sorted set with the same elements as its
|
||||
* argument, sorted according to the natural ordering of the elements.
|
||||
* 4) A constructor with a single argument of type <tt>SortedSet</tt>,
|
||||
* 4) A constructor with a single argument of type {@code SortedSet},
|
||||
* which creates a new sorted set with the same elements and the same
|
||||
* ordering as the input sorted set. There is no way to enforce this
|
||||
* recommendation, as interfaces cannot contain constructors.
|
||||
@ -75,17 +75,17 @@ package java.util;
|
||||
* endpoint but not their high endpoint (where applicable).
|
||||
* If you need a <i>closed range</i> (which includes both endpoints), and
|
||||
* the element type allows for calculation of the successor of a given
|
||||
* value, merely request the subrange from <tt>lowEndpoint</tt> to
|
||||
* <tt>successor(highEndpoint)</tt>. For example, suppose that <tt>s</tt>
|
||||
* value, merely request the subrange from {@code lowEndpoint} to
|
||||
* {@code successor(highEndpoint)}. For example, suppose that {@code s}
|
||||
* is a sorted set of strings. The following idiom obtains a view
|
||||
* containing all of the strings in <tt>s</tt> from <tt>low</tt> to
|
||||
* <tt>high</tt>, inclusive:<pre>
|
||||
* containing all of the strings in {@code s} from {@code low} to
|
||||
* {@code high}, inclusive:<pre>
|
||||
* SortedSet<String> sub = s.subSet(low, high+"\0");</pre>
|
||||
*
|
||||
* A similar technique can be used to generate an <i>open range</i> (which
|
||||
* contains neither endpoint). The following idiom obtains a view
|
||||
* containing all of the Strings in <tt>s</tt> from <tt>low</tt> to
|
||||
* <tt>high</tt>, exclusive:<pre>
|
||||
* containing all of the Strings in {@code s} from {@code low} to
|
||||
* {@code high}, exclusive:<pre>
|
||||
* SortedSet<String> sub = s.subSet(low+"\0", high);</pre>
|
||||
*
|
||||
* <p>This interface is a member of the
|
||||
@ -108,98 +108,98 @@ package java.util;
|
||||
public interface SortedSet<E> extends Set<E> {
|
||||
/**
|
||||
* Returns the comparator used to order the elements in this set,
|
||||
* or <tt>null</tt> if this set uses the {@linkplain Comparable
|
||||
* or {@code null} if this set uses the {@linkplain Comparable
|
||||
* natural ordering} of its elements.
|
||||
*
|
||||
* @return the comparator used to order the elements in this set,
|
||||
* or <tt>null</tt> if this set uses the natural ordering
|
||||
* or {@code null} if this set uses the natural ordering
|
||||
* of its elements
|
||||
*/
|
||||
Comparator<? super E> comparator();
|
||||
|
||||
/**
|
||||
* Returns a view of the portion of this set whose elements range
|
||||
* from <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>,
|
||||
* exclusive. (If <tt>fromElement</tt> and <tt>toElement</tt> are
|
||||
* from {@code fromElement}, inclusive, to {@code toElement},
|
||||
* exclusive. (If {@code fromElement} and {@code toElement} are
|
||||
* equal, the returned set is empty.) The returned set is backed
|
||||
* by this set, so changes in the returned set are reflected in
|
||||
* this set, and vice-versa. The returned set supports all
|
||||
* optional set operations that this set supports.
|
||||
*
|
||||
* <p>The returned set will throw an <tt>IllegalArgumentException</tt>
|
||||
* <p>The returned set will throw an {@code IllegalArgumentException}
|
||||
* on an attempt to insert an element outside its range.
|
||||
*
|
||||
* @param fromElement low endpoint (inclusive) of the returned set
|
||||
* @param toElement high endpoint (exclusive) of the returned set
|
||||
* @return a view of the portion of this set whose elements range from
|
||||
* <tt>fromElement</tt>, inclusive, to <tt>toElement</tt>, exclusive
|
||||
* @throws ClassCastException if <tt>fromElement</tt> and
|
||||
* <tt>toElement</tt> cannot be compared to one another using this
|
||||
* {@code fromElement}, inclusive, to {@code toElement}, exclusive
|
||||
* @throws ClassCastException if {@code fromElement} and
|
||||
* {@code toElement} cannot be compared to one another using this
|
||||
* set's comparator (or, if the set has no comparator, using
|
||||
* natural ordering). Implementations may, but are not required
|
||||
* to, throw this exception if <tt>fromElement</tt> or
|
||||
* <tt>toElement</tt> cannot be compared to elements currently in
|
||||
* to, throw this exception if {@code fromElement} or
|
||||
* {@code toElement} cannot be compared to elements currently in
|
||||
* the set.
|
||||
* @throws NullPointerException if <tt>fromElement</tt> or
|
||||
* <tt>toElement</tt> is null and this set does not permit null
|
||||
* @throws NullPointerException if {@code fromElement} or
|
||||
* {@code toElement} is null and this set does not permit null
|
||||
* elements
|
||||
* @throws IllegalArgumentException if <tt>fromElement</tt> is
|
||||
* greater than <tt>toElement</tt>; or if this set itself
|
||||
* has a restricted range, and <tt>fromElement</tt> or
|
||||
* <tt>toElement</tt> lies outside the bounds of the range
|
||||
* @throws IllegalArgumentException if {@code fromElement} is
|
||||
* greater than {@code toElement}; or if this set itself
|
||||
* has a restricted range, and {@code fromElement} or
|
||||
* {@code toElement} lies outside the bounds of the range
|
||||
*/
|
||||
SortedSet<E> subSet(E fromElement, E toElement);
|
||||
|
||||
/**
|
||||
* Returns a view of the portion of this set whose elements are
|
||||
* strictly less than <tt>toElement</tt>. The returned set is
|
||||
* strictly less than {@code toElement}. The returned set is
|
||||
* backed by this set, so changes in the returned set are
|
||||
* reflected in this set, and vice-versa. The returned set
|
||||
* supports all optional set operations that this set supports.
|
||||
*
|
||||
* <p>The returned set will throw an <tt>IllegalArgumentException</tt>
|
||||
* <p>The returned set will throw an {@code IllegalArgumentException}
|
||||
* on an attempt to insert an element outside its range.
|
||||
*
|
||||
* @param toElement high endpoint (exclusive) of the returned set
|
||||
* @return a view of the portion of this set whose elements are strictly
|
||||
* less than <tt>toElement</tt>
|
||||
* @throws ClassCastException if <tt>toElement</tt> is not compatible
|
||||
* less than {@code toElement}
|
||||
* @throws ClassCastException if {@code toElement} is not compatible
|
||||
* with this set's comparator (or, if the set has no comparator,
|
||||
* if <tt>toElement</tt> does not implement {@link Comparable}).
|
||||
* if {@code toElement} does not implement {@link Comparable}).
|
||||
* Implementations may, but are not required to, throw this
|
||||
* exception if <tt>toElement</tt> cannot be compared to elements
|
||||
* exception if {@code toElement} cannot be compared to elements
|
||||
* currently in the set.
|
||||
* @throws NullPointerException if <tt>toElement</tt> is null and
|
||||
* @throws NullPointerException if {@code toElement} is null and
|
||||
* this set does not permit null elements
|
||||
* @throws IllegalArgumentException if this set itself has a
|
||||
* restricted range, and <tt>toElement</tt> lies outside the
|
||||
* restricted range, and {@code toElement} lies outside the
|
||||
* bounds of the range
|
||||
*/
|
||||
SortedSet<E> headSet(E toElement);
|
||||
|
||||
/**
|
||||
* Returns a view of the portion of this set whose elements are
|
||||
* greater than or equal to <tt>fromElement</tt>. The returned
|
||||
* greater than or equal to {@code fromElement}. The returned
|
||||
* set is backed by this set, so changes in the returned set are
|
||||
* reflected in this set, and vice-versa. The returned set
|
||||
* supports all optional set operations that this set supports.
|
||||
*
|
||||
* <p>The returned set will throw an <tt>IllegalArgumentException</tt>
|
||||
* <p>The returned set will throw an {@code IllegalArgumentException}
|
||||
* on an attempt to insert an element outside its range.
|
||||
*
|
||||
* @param fromElement low endpoint (inclusive) of the returned set
|
||||
* @return a view of the portion of this set whose elements are greater
|
||||
* than or equal to <tt>fromElement</tt>
|
||||
* @throws ClassCastException if <tt>fromElement</tt> is not compatible
|
||||
* than or equal to {@code fromElement}
|
||||
* @throws ClassCastException if {@code fromElement} is not compatible
|
||||
* with this set's comparator (or, if the set has no comparator,
|
||||
* if <tt>fromElement</tt> does not implement {@link Comparable}).
|
||||
* if {@code fromElement} does not implement {@link Comparable}).
|
||||
* Implementations may, but are not required to, throw this
|
||||
* exception if <tt>fromElement</tt> cannot be compared to elements
|
||||
* exception if {@code fromElement} cannot be compared to elements
|
||||
* currently in the set.
|
||||
* @throws NullPointerException if <tt>fromElement</tt> is null
|
||||
* @throws NullPointerException if {@code fromElement} is null
|
||||
* and this set does not permit null elements
|
||||
* @throws IllegalArgumentException if this set itself has a
|
||||
* restricted range, and <tt>fromElement</tt> lies outside the
|
||||
* restricted range, and {@code fromElement} lies outside the
|
||||
* bounds of the range
|
||||
*/
|
||||
SortedSet<E> tailSet(E fromElement);
|
||||
|
||||
@ -26,12 +26,12 @@
|
||||
package java.util;
|
||||
|
||||
/**
|
||||
* The <code>Stack</code> class represents a last-in-first-out
|
||||
* (LIFO) stack of objects. It extends class <tt>Vector</tt> with five
|
||||
* The {@code Stack} class represents a last-in-first-out
|
||||
* (LIFO) stack of objects. It extends class {@code Vector} with five
|
||||
* operations that allow a vector to be treated as a stack. The usual
|
||||
* <tt>push</tt> and <tt>pop</tt> operations are provided, as well as a
|
||||
* method to <tt>peek</tt> at the top item on the stack, a method to test
|
||||
* for whether the stack is <tt>empty</tt>, and a method to <tt>search</tt>
|
||||
* {@code push} and {@code pop} operations are provided, as well as a
|
||||
* method to {@code peek} at the top item on the stack, a method to test
|
||||
* for whether the stack is {@code empty}, and a method to {@code search}
|
||||
* the stack for an item and discover how far it is from the top.
|
||||
* <p>
|
||||
* When a stack is first created, it contains no items.
|
||||
@ -60,7 +60,7 @@ class Stack<E> extends Vector<E> {
|
||||
* addElement(item)</pre></blockquote>
|
||||
*
|
||||
* @param item the item to be pushed onto this stack.
|
||||
* @return the <code>item</code> argument.
|
||||
* @return the {@code item} argument.
|
||||
* @see java.util.Vector#addElement
|
||||
*/
|
||||
public E push(E item) {
|
||||
@ -74,7 +74,7 @@ class Stack<E> extends Vector<E> {
|
||||
* object as the value of this function.
|
||||
*
|
||||
* @return The object at the top of this stack (the last item
|
||||
* of the <tt>Vector</tt> object).
|
||||
* of the {@code Vector} object).
|
||||
* @throws EmptyStackException if this stack is empty.
|
||||
*/
|
||||
public synchronized E pop() {
|
||||
@ -92,7 +92,7 @@ class Stack<E> extends Vector<E> {
|
||||
* from the stack.
|
||||
*
|
||||
* @return the object at the top of this stack (the last item
|
||||
* of the <tt>Vector</tt> object).
|
||||
* of the {@code Vector} object).
|
||||
* @throws EmptyStackException if this stack is empty.
|
||||
*/
|
||||
public synchronized E peek() {
|
||||
@ -106,8 +106,8 @@ class Stack<E> extends Vector<E> {
|
||||
/**
|
||||
* Tests if this stack is empty.
|
||||
*
|
||||
* @return <code>true</code> if and only if this stack contains
|
||||
* no items; <code>false</code> otherwise.
|
||||
* @return {@code true} if and only if this stack contains
|
||||
* no items; {@code false} otherwise.
|
||||
*/
|
||||
public boolean empty() {
|
||||
return size() == 0;
|
||||
@ -115,16 +115,16 @@ class Stack<E> extends Vector<E> {
|
||||
|
||||
/**
|
||||
* Returns the 1-based position where an object is on this stack.
|
||||
* If the object <tt>o</tt> occurs as an item in this stack, this
|
||||
* If the object {@code o} occurs as an item in this stack, this
|
||||
* method returns the distance from the top of the stack of the
|
||||
* occurrence nearest the top of the stack; the topmost item on the
|
||||
* stack is considered to be at distance <tt>1</tt>. The <tt>equals</tt>
|
||||
* method is used to compare <tt>o</tt> to the
|
||||
* stack is considered to be at distance {@code 1}. The {@code equals}
|
||||
* method is used to compare {@code o} to the
|
||||
* items in this stack.
|
||||
*
|
||||
* @param o the desired object.
|
||||
* @return the 1-based position from the top of the stack where
|
||||
* the object is located; the return value <code>-1</code>
|
||||
* the object is located; the return value {@code -1}
|
||||
* indicates that the object is not on the stack.
|
||||
*/
|
||||
public synchronized int search(Object o) {
|
||||
|
||||
@ -30,32 +30,32 @@ import java.lang.*;
|
||||
/**
|
||||
* The string tokenizer class allows an application to break a
|
||||
* string into tokens. The tokenization method is much simpler than
|
||||
* the one used by the <code>StreamTokenizer</code> class. The
|
||||
* <code>StringTokenizer</code> methods do not distinguish among
|
||||
* the one used by the {@code StreamTokenizer} class. The
|
||||
* {@code StringTokenizer} methods do not distinguish among
|
||||
* identifiers, numbers, and quoted strings, nor do they recognize
|
||||
* and skip comments.
|
||||
* <p>
|
||||
* The set of delimiters (the characters that separate tokens) may
|
||||
* be specified either at creation time or on a per-token basis.
|
||||
* <p>
|
||||
* An instance of <code>StringTokenizer</code> behaves in one of two
|
||||
* An instance of {@code StringTokenizer} behaves in one of two
|
||||
* ways, depending on whether it was created with the
|
||||
* <code>returnDelims</code> flag having the value <code>true</code>
|
||||
* or <code>false</code>:
|
||||
* {@code returnDelims} flag having the value {@code true}
|
||||
* or {@code false}:
|
||||
* <ul>
|
||||
* <li>If the flag is <code>false</code>, delimiter characters serve to
|
||||
* <li>If the flag is {@code false}, delimiter characters serve to
|
||||
* separate tokens. A token is a maximal sequence of consecutive
|
||||
* characters that are not delimiters.
|
||||
* <li>If the flag is <code>true</code>, delimiter characters are themselves
|
||||
* <li>If the flag is {@code true}, delimiter characters are themselves
|
||||
* considered to be tokens. A token is thus either one delimiter
|
||||
* character, or a maximal sequence of consecutive characters that are
|
||||
* not delimiters.
|
||||
* </ul><p>
|
||||
* A <tt>StringTokenizer</tt> object internally maintains a current
|
||||
* A {@code StringTokenizer} object internally maintains a current
|
||||
* position within the string to be tokenized. Some operations advance this
|
||||
* current position past the characters processed.<p>
|
||||
* A token is returned by taking a substring of the string that was used to
|
||||
* create the <tt>StringTokenizer</tt> object.
|
||||
* create the {@code StringTokenizer} object.
|
||||
* <p>
|
||||
* The following is one example of the use of the tokenizer. The code:
|
||||
* <blockquote><pre>
|
||||
@ -74,12 +74,12 @@ import java.lang.*;
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <p>
|
||||
* <tt>StringTokenizer</tt> is a legacy class that is retained for
|
||||
* {@code StringTokenizer} is a legacy class that is retained for
|
||||
* compatibility reasons although its use is discouraged in new code. It is
|
||||
* recommended that anyone seeking this functionality use the <tt>split</tt>
|
||||
* method of <tt>String</tt> or the java.util.regex package instead.
|
||||
* recommended that anyone seeking this functionality use the {@code split}
|
||||
* method of {@code String} or the java.util.regex package instead.
|
||||
* <p>
|
||||
* The following example illustrates how the <tt>String.split</tt>
|
||||
* The following example illustrates how the {@code String.split}
|
||||
* method can be used to break up a string into its basic tokens:
|
||||
* <blockquote><pre>
|
||||
* String[] result = "this is a test".split("\\s");
|
||||
@ -171,25 +171,25 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
|
||||
/**
|
||||
* Constructs a string tokenizer for the specified string. All
|
||||
* characters in the <code>delim</code> argument are the delimiters
|
||||
* characters in the {@code delim} argument are the delimiters
|
||||
* for separating tokens.
|
||||
* <p>
|
||||
* If the <code>returnDelims</code> flag is <code>true</code>, then
|
||||
* If the {@code returnDelims} flag is {@code true}, then
|
||||
* the delimiter characters are also returned as tokens. Each
|
||||
* delimiter is returned as a string of length one. If the flag is
|
||||
* <code>false</code>, the delimiter characters are skipped and only
|
||||
* {@code false}, the delimiter characters are skipped and only
|
||||
* serve as separators between tokens.
|
||||
* <p>
|
||||
* Note that if <tt>delim</tt> is <tt>null</tt>, this constructor does
|
||||
* Note that if {@code delim} is {@code null}, this constructor does
|
||||
* not throw an exception. However, trying to invoke other methods on the
|
||||
* resulting <tt>StringTokenizer</tt> may result in a
|
||||
* <tt>NullPointerException</tt>.
|
||||
* resulting {@code StringTokenizer} may result in a
|
||||
* {@code NullPointerException}.
|
||||
*
|
||||
* @param str a string to be parsed.
|
||||
* @param delim the delimiters.
|
||||
* @param returnDelims flag indicating whether to return the delimiters
|
||||
* as tokens.
|
||||
* @exception NullPointerException if str is <CODE>null</CODE>
|
||||
* @exception NullPointerException if str is {@code null}
|
||||
*/
|
||||
public StringTokenizer(String str, String delim, boolean returnDelims) {
|
||||
currentPosition = 0;
|
||||
@ -204,18 +204,18 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
|
||||
/**
|
||||
* Constructs a string tokenizer for the specified string. The
|
||||
* characters in the <code>delim</code> argument are the delimiters
|
||||
* characters in the {@code delim} argument are the delimiters
|
||||
* for separating tokens. Delimiter characters themselves will not
|
||||
* be treated as tokens.
|
||||
* <p>
|
||||
* Note that if <tt>delim</tt> is <tt>null</tt>, this constructor does
|
||||
* Note that if {@code delim} is {@code null}, this constructor does
|
||||
* not throw an exception. However, trying to invoke other methods on the
|
||||
* resulting <tt>StringTokenizer</tt> may result in a
|
||||
* <tt>NullPointerException</tt>.
|
||||
* resulting {@code StringTokenizer} may result in a
|
||||
* {@code NullPointerException}.
|
||||
*
|
||||
* @param str a string to be parsed.
|
||||
* @param delim the delimiters.
|
||||
* @exception NullPointerException if str is <CODE>null</CODE>
|
||||
* @exception NullPointerException if str is {@code null}
|
||||
*/
|
||||
public StringTokenizer(String str, String delim) {
|
||||
this(str, delim, false);
|
||||
@ -230,7 +230,7 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
* not be treated as tokens.
|
||||
*
|
||||
* @param str a string to be parsed.
|
||||
* @exception NullPointerException if str is <CODE>null</CODE>
|
||||
* @exception NullPointerException if str is {@code null}
|
||||
*/
|
||||
public StringTokenizer(String str) {
|
||||
this(str, " \t\n\r\f", false);
|
||||
@ -307,11 +307,11 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
|
||||
/**
|
||||
* Tests if there are more tokens available from this tokenizer's string.
|
||||
* If this method returns <tt>true</tt>, then a subsequent call to
|
||||
* <tt>nextToken</tt> with no argument will successfully return a token.
|
||||
* If this method returns {@code true}, then a subsequent call to
|
||||
* {@code nextToken} with no argument will successfully return a token.
|
||||
*
|
||||
* @return <code>true</code> if and only if there is at least one token
|
||||
* in the string after the current position; <code>false</code>
|
||||
* @return {@code true} if and only if there is at least one token
|
||||
* in the string after the current position; {@code false}
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean hasMoreTokens() {
|
||||
@ -355,8 +355,8 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
/**
|
||||
* Returns the next token in this string tokenizer's string. First,
|
||||
* the set of characters considered to be delimiters by this
|
||||
* <tt>StringTokenizer</tt> object is changed to be the characters in
|
||||
* the string <tt>delim</tt>. Then the next token in the string
|
||||
* {@code StringTokenizer} object is changed to be the characters in
|
||||
* the string {@code delim}. Then the next token in the string
|
||||
* after the current position is returned. The current position is
|
||||
* advanced beyond the recognized token. The new delimiter set
|
||||
* remains the default after this call.
|
||||
@ -365,7 +365,7 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
* @return the next token, after switching to the new delimiter set.
|
||||
* @exception NoSuchElementException if there are no more tokens in this
|
||||
* tokenizer's string.
|
||||
* @exception NullPointerException if delim is <CODE>null</CODE>
|
||||
* @exception NullPointerException if delim is {@code null}
|
||||
*/
|
||||
public String nextToken(String delim) {
|
||||
delimiters = delim;
|
||||
@ -378,12 +378,12 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the same value as the <code>hasMoreTokens</code>
|
||||
* Returns the same value as the {@code hasMoreTokens}
|
||||
* method. It exists so that this class can implement the
|
||||
* <code>Enumeration</code> interface.
|
||||
* {@code Enumeration} interface.
|
||||
*
|
||||
* @return <code>true</code> if there are more tokens;
|
||||
* <code>false</code> otherwise.
|
||||
* @return {@code true} if there are more tokens;
|
||||
* {@code false} otherwise.
|
||||
* @see java.util.Enumeration
|
||||
* @see java.util.StringTokenizer#hasMoreTokens()
|
||||
*/
|
||||
@ -392,10 +392,10 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the same value as the <code>nextToken</code> method,
|
||||
* except that its declared return value is <code>Object</code> rather than
|
||||
* <code>String</code>. It exists so that this class can implement the
|
||||
* <code>Enumeration</code> interface.
|
||||
* Returns the same value as the {@code nextToken} method,
|
||||
* except that its declared return value is {@code Object} rather than
|
||||
* {@code String}. It exists so that this class can implement the
|
||||
* {@code Enumeration} interface.
|
||||
*
|
||||
* @return the next token in the string.
|
||||
* @exception NoSuchElementException if there are no more tokens in this
|
||||
@ -409,7 +409,7 @@ class StringTokenizer implements Enumeration<Object> {
|
||||
|
||||
/**
|
||||
* Calculates the number of times that this tokenizer's
|
||||
* <code>nextToken</code> method can be called before it generates an
|
||||
* {@code nextToken} method can be called before it generates an
|
||||
* exception. The current position is not advanced.
|
||||
*
|
||||
* @return the number of tokens remaining in the string using the current
|
||||
|
||||
@ -32,7 +32,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* background thread. Tasks may be scheduled for one-time execution, or for
|
||||
* repeated execution at regular intervals.
|
||||
*
|
||||
* <p>Corresponding to each <tt>Timer</tt> object is a single background
|
||||
* <p>Corresponding to each {@code Timer} object is a single background
|
||||
* thread that is used to execute all of the timer's tasks, sequentially.
|
||||
* Timer tasks should complete quickly. If a timer task takes excessive time
|
||||
* to complete, it "hogs" the timer's task execution thread. This can, in
|
||||
@ -40,26 +40,26 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* execute in rapid succession when (and if) the offending task finally
|
||||
* completes.
|
||||
*
|
||||
* <p>After the last live reference to a <tt>Timer</tt> object goes away
|
||||
* <p>After the last live reference to a {@code Timer} object goes away
|
||||
* <i>and</i> all outstanding tasks have completed execution, the timer's task
|
||||
* execution thread terminates gracefully (and becomes subject to garbage
|
||||
* collection). However, this can take arbitrarily long to occur. By
|
||||
* default, the task execution thread does not run as a <i>daemon thread</i>,
|
||||
* so it is capable of keeping an application from terminating. If a caller
|
||||
* wants to terminate a timer's task execution thread rapidly, the caller
|
||||
* should invoke the timer's <tt>cancel</tt> method.
|
||||
* should invoke the timer's {@code cancel} method.
|
||||
*
|
||||
* <p>If the timer's task execution thread terminates unexpectedly, for
|
||||
* example, because its <tt>stop</tt> method is invoked, any further
|
||||
* example, because its {@code stop} method is invoked, any further
|
||||
* attempt to schedule a task on the timer will result in an
|
||||
* <tt>IllegalStateException</tt>, as if the timer's <tt>cancel</tt>
|
||||
* {@code IllegalStateException}, as if the timer's {@code cancel}
|
||||
* method had been invoked.
|
||||
*
|
||||
* <p>This class is thread-safe: multiple threads can share a single
|
||||
* <tt>Timer</tt> object without the need for external synchronization.
|
||||
* {@code Timer} object without the need for external synchronization.
|
||||
*
|
||||
* <p>This class does <i>not</i> offer real-time guarantees: it schedules
|
||||
* tasks using the <tt>Object.wait(long)</tt> method.
|
||||
* tasks using the {@code Object.wait(long)} method.
|
||||
*
|
||||
* <p>Java 5.0 introduced the {@code java.util.concurrent} package and
|
||||
* one of the concurrency utilities therein is the {@link
|
||||
@ -181,8 +181,8 @@ public class Timer {
|
||||
*
|
||||
* @param task task to be scheduled.
|
||||
* @param delay delay in milliseconds before task is to be executed.
|
||||
* @throws IllegalArgumentException if <tt>delay</tt> is negative, or
|
||||
* <tt>delay + System.currentTimeMillis()</tt> is negative.
|
||||
* @throws IllegalArgumentException if {@code delay} is negative, or
|
||||
* {@code delay + System.currentTimeMillis()} is negative.
|
||||
* @throws IllegalStateException if task was already scheduled or
|
||||
* cancelled, timer was cancelled, or timer thread terminated.
|
||||
* @throws NullPointerException if {@code task} is null
|
||||
@ -199,7 +199,7 @@ public class Timer {
|
||||
*
|
||||
* @param task task to be scheduled.
|
||||
* @param time time at which task is to be executed.
|
||||
* @throws IllegalArgumentException if <tt>time.getTime()</tt> is negative.
|
||||
* @throws IllegalArgumentException if {@code time.getTime()} is negative.
|
||||
* @throws IllegalStateException if task was already scheduled or
|
||||
* cancelled, timer was cancelled, or timer thread terminated.
|
||||
* @throws NullPointerException if {@code task} or {@code time} is null
|
||||
@ -219,7 +219,7 @@ public class Timer {
|
||||
* background activity), subsequent executions will be delayed as well.
|
||||
* In the long run, the frequency of execution will generally be slightly
|
||||
* lower than the reciprocal of the specified period (assuming the system
|
||||
* clock underlying <tt>Object.wait(long)</tt> is accurate).
|
||||
* clock underlying {@code Object.wait(long)} is accurate).
|
||||
*
|
||||
* <p>Fixed-delay execution is appropriate for recurring activities
|
||||
* that require "smoothness." In other words, it is appropriate for
|
||||
@ -259,7 +259,7 @@ public class Timer {
|
||||
* background activity), subsequent executions will be delayed as well.
|
||||
* In the long run, the frequency of execution will generally be slightly
|
||||
* lower than the reciprocal of the specified period (assuming the system
|
||||
* clock underlying <tt>Object.wait(long)</tt> is accurate). As a
|
||||
* clock underlying {@code Object.wait(long)} is accurate). As a
|
||||
* consequence of the above, if the scheduled first time is in the past,
|
||||
* it is scheduled for immediate execution.
|
||||
*
|
||||
@ -298,7 +298,7 @@ public class Timer {
|
||||
* activity), two or more executions will occur in rapid succession to
|
||||
* "catch up." In the long run, the frequency of execution will be
|
||||
* exactly the reciprocal of the specified period (assuming the system
|
||||
* clock underlying <tt>Object.wait(long)</tt> is accurate).
|
||||
* clock underlying {@code Object.wait(long)} is accurate).
|
||||
*
|
||||
* <p>Fixed-rate execution is appropriate for recurring activities that
|
||||
* are sensitive to <i>absolute</i> time, such as ringing a chime every
|
||||
@ -339,7 +339,7 @@ public class Timer {
|
||||
* activity), two or more executions will occur in rapid succession to
|
||||
* "catch up." In the long run, the frequency of execution will be
|
||||
* exactly the reciprocal of the specified period (assuming the system
|
||||
* clock underlying <tt>Object.wait(long)</tt> is accurate). As a
|
||||
* clock underlying {@code Object.wait(long)} is accurate). As a
|
||||
* consequence of the above, if the scheduled first time is in the past,
|
||||
* then any "missed" executions will be scheduled for immediate "catch up"
|
||||
* execution.
|
||||
@ -378,7 +378,7 @@ public class Timer {
|
||||
* in Date.getTime() format. This method checks timer state, task state,
|
||||
* and initial execution time, but not period.
|
||||
*
|
||||
* @throws IllegalArgumentException if <tt>time</tt> is negative.
|
||||
* @throws IllegalArgumentException if {@code time} is negative.
|
||||
* @throws IllegalStateException if task was already scheduled or
|
||||
* cancelled, timer was cancelled, or timer thread terminated.
|
||||
* @throws NullPointerException if {@code task} is null
|
||||
|
||||
@ -102,7 +102,7 @@ public abstract class TimerTask implements Runnable {
|
||||
* will never run again. (If the task is running when this call occurs,
|
||||
* the task will run to completion, but will never run again.)
|
||||
*
|
||||
* <p>Note that calling this method from within the <tt>run</tt> method of
|
||||
* <p>Note that calling this method from within the {@code run} method of
|
||||
* a repeating timer task absolutely guarantees that the timer task will
|
||||
* not run again.
|
||||
*
|
||||
@ -114,7 +114,7 @@ public abstract class TimerTask implements Runnable {
|
||||
* Returns false if the task was scheduled for one-time execution
|
||||
* and has already run, or if the task was never scheduled, or if
|
||||
* the task was already cancelled. (Loosely speaking, this method
|
||||
* returns <tt>true</tt> if it prevents one or more scheduled
|
||||
* returns {@code true} if it prevents one or more scheduled
|
||||
* executions from taking place.)
|
||||
*/
|
||||
public boolean cancel() {
|
||||
|
||||
@ -220,7 +220,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
* Returns {@code true} if this set contains the specified element.
|
||||
* More formally, returns {@code true} if and only if this set
|
||||
* contains an element {@code e} such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>.
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param o object to be checked for containment in this set
|
||||
* @return {@code true} if this set contains the specified element
|
||||
@ -238,7 +238,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
* Adds the specified element to this set if it is not already present.
|
||||
* More formally, adds the specified element {@code e} to this set if
|
||||
* the set contains no element {@code e2} such that
|
||||
* <tt>(e==null ? e2==null : e.equals(e2))</tt>.
|
||||
* {@code Objects.equals(e, e2)}.
|
||||
* If this set already contains the element, the call leaves the set
|
||||
* unchanged and returns {@code false}.
|
||||
*
|
||||
@ -258,7 +258,7 @@ public class TreeSet<E> extends AbstractSet<E>
|
||||
/**
|
||||
* Removes the specified element from this set if it is present.
|
||||
* More formally, removes an element {@code e} such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>,
|
||||
* {@code Objects.equals(o, e)},
|
||||
* if this set contains such an element. Returns {@code true} if
|
||||
* this set contained the element (or equivalently, if this set
|
||||
* changed as a result of the call). (This set will not contain the
|
||||
|
||||
@ -28,7 +28,7 @@ package java.util;
|
||||
/**
|
||||
* Unchecked exception thrown when an unknown conversion is given.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to
|
||||
* any method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -28,7 +28,7 @@ package java.util;
|
||||
/**
|
||||
* Unchecked exception thrown when an unknown flag is given.
|
||||
*
|
||||
* <p> Unless otherwise specified, passing a <tt>null</tt> argument to any
|
||||
* <p> Unless otherwise specified, passing a {@code null} argument to any
|
||||
* method or constructor in this class will cause a {@link
|
||||
* NullPointerException} to be thrown.
|
||||
*
|
||||
|
||||
@ -365,7 +365,7 @@ public class Vector<E>
|
||||
* Returns {@code true} if this vector contains the specified element.
|
||||
* More formally, returns {@code true} if and only if this vector
|
||||
* contains at least one element {@code e} such that
|
||||
* <tt>(o==null ? e==null : o.equals(e))</tt>.
|
||||
* {@code Objects.equals(o, e)}.
|
||||
*
|
||||
* @param o element whose presence in this vector is to be tested
|
||||
* @return {@code true} if this vector contains the specified element
|
||||
@ -378,7 +378,7 @@ public class Vector<E>
|
||||
* Returns the index of the first occurrence of the specified element
|
||||
* in this vector, or -1 if this vector does not contain the element.
|
||||
* More formally, returns the lowest index {@code i} such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
|
||||
* {@code Objects.equals(o, get(i))},
|
||||
* or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for
|
||||
@ -394,7 +394,7 @@ public class Vector<E>
|
||||
* this vector, searching forwards from {@code index}, or returns -1 if
|
||||
* the element is not found.
|
||||
* More formally, returns the lowest index {@code i} such that
|
||||
* <tt>(i >= index && (o==null ? get(i)==null : o.equals(get(i))))</tt>,
|
||||
* {@code (i >= index && Objects.equals(o, get(i)))},
|
||||
* or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for
|
||||
@ -422,7 +422,7 @@ public class Vector<E>
|
||||
* Returns the index of the last occurrence of the specified element
|
||||
* in this vector, or -1 if this vector does not contain the element.
|
||||
* More formally, returns the highest index {@code i} such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>,
|
||||
* {@code Objects.equals(o, get(i))},
|
||||
* or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for
|
||||
@ -438,7 +438,7 @@ public class Vector<E>
|
||||
* this vector, searching backwards from {@code index}, or returns -1 if
|
||||
* the element is not found.
|
||||
* More formally, returns the highest index {@code i} such that
|
||||
* <tt>(i <= index && (o==null ? get(i)==null : o.equals(get(i))))</tt>,
|
||||
* {@code (i <= index && Objects.equals(o, get(i)))},
|
||||
* or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for
|
||||
@ -798,7 +798,7 @@ public class Vector<E>
|
||||
* Removes the first occurrence of the specified element in this Vector
|
||||
* If the Vector does not contain the element, it is unchanged. More
|
||||
* formally, removes the element with the lowest index i such that
|
||||
* {@code (o==null ? get(i)==null : o.equals(get(i)))} (if such
|
||||
* {@code Objects.equals(o, get(i))} (if such
|
||||
* an element exists).
|
||||
*
|
||||
* @param o element to be removed from this Vector, if present
|
||||
@ -991,8 +991,8 @@ public class Vector<E>
|
||||
* true if and only if the specified Object is also a List, both Lists
|
||||
* have the same size, and all corresponding pairs of elements in the two
|
||||
* Lists are <em>equal</em>. (Two elements {@code e1} and
|
||||
* {@code e2} are <em>equal</em> if {@code (e1==null ? e2==null :
|
||||
* e1.equals(e2))}.) In other words, two Lists are defined to be
|
||||
* {@code e2} are <em>equal</em> if {@code Objects.equals(e1, e2)}.)
|
||||
* In other words, two Lists are defined to be
|
||||
* equal if they contain the same elements in the same order.
|
||||
*
|
||||
* @param o the Object to be compared for equality with this Vector
|
||||
|
||||
@ -34,79 +34,79 @@ import java.util.function.Consumer;
|
||||
|
||||
|
||||
/**
|
||||
* Hash table based implementation of the <tt>Map</tt> interface, with
|
||||
* Hash table based implementation of the {@code Map} interface, with
|
||||
* <em>weak keys</em>.
|
||||
* An entry in a <tt>WeakHashMap</tt> will automatically be removed when
|
||||
* An entry in a {@code WeakHashMap} will automatically be removed when
|
||||
* its key is no longer in ordinary use. More precisely, the presence of a
|
||||
* mapping for a given key will not prevent the key from being discarded by the
|
||||
* garbage collector, that is, made finalizable, finalized, and then reclaimed.
|
||||
* When a key has been discarded its entry is effectively removed from the map,
|
||||
* so this class behaves somewhat differently from other <tt>Map</tt>
|
||||
* so this class behaves somewhat differently from other {@code Map}
|
||||
* implementations.
|
||||
*
|
||||
* <p> Both null values and the null key are supported. This class has
|
||||
* performance characteristics similar to those of the <tt>HashMap</tt>
|
||||
* performance characteristics similar to those of the {@code HashMap}
|
||||
* class, and has the same efficiency parameters of <em>initial capacity</em>
|
||||
* and <em>load factor</em>.
|
||||
*
|
||||
* <p> Like most collection classes, this class is not synchronized.
|
||||
* A synchronized <tt>WeakHashMap</tt> may be constructed using the
|
||||
* A synchronized {@code WeakHashMap} may be constructed using the
|
||||
* {@link Collections#synchronizedMap Collections.synchronizedMap}
|
||||
* method.
|
||||
*
|
||||
* <p> This class is intended primarily for use with key objects whose
|
||||
* <tt>equals</tt> methods test for object identity using the
|
||||
* <tt>==</tt> operator. Once such a key is discarded it can never be
|
||||
* {@code equals} methods test for object identity using the
|
||||
* {@code ==} operator. Once such a key is discarded it can never be
|
||||
* recreated, so it is impossible to do a lookup of that key in a
|
||||
* <tt>WeakHashMap</tt> at some later time and be surprised that its entry
|
||||
* {@code WeakHashMap} at some later time and be surprised that its entry
|
||||
* has been removed. This class will work perfectly well with key objects
|
||||
* whose <tt>equals</tt> methods are not based upon object identity, such
|
||||
* as <tt>String</tt> instances. With such recreatable key objects,
|
||||
* however, the automatic removal of <tt>WeakHashMap</tt> entries whose
|
||||
* whose {@code equals} methods are not based upon object identity, such
|
||||
* as {@code String} instances. With such recreatable key objects,
|
||||
* however, the automatic removal of {@code WeakHashMap} entries whose
|
||||
* keys have been discarded may prove to be confusing.
|
||||
*
|
||||
* <p> The behavior of the <tt>WeakHashMap</tt> class depends in part upon
|
||||
* <p> The behavior of the {@code WeakHashMap} class depends in part upon
|
||||
* the actions of the garbage collector, so several familiar (though not
|
||||
* required) <tt>Map</tt> invariants do not hold for this class. Because
|
||||
* required) {@code Map} invariants do not hold for this class. Because
|
||||
* the garbage collector may discard keys at any time, a
|
||||
* <tt>WeakHashMap</tt> may behave as though an unknown thread is silently
|
||||
* {@code WeakHashMap} may behave as though an unknown thread is silently
|
||||
* removing entries. In particular, even if you synchronize on a
|
||||
* <tt>WeakHashMap</tt> instance and invoke none of its mutator methods, it
|
||||
* is possible for the <tt>size</tt> method to return smaller values over
|
||||
* time, for the <tt>isEmpty</tt> method to return <tt>false</tt> and
|
||||
* then <tt>true</tt>, for the <tt>containsKey</tt> method to return
|
||||
* <tt>true</tt> and later <tt>false</tt> for a given key, for the
|
||||
* <tt>get</tt> method to return a value for a given key but later return
|
||||
* <tt>null</tt>, for the <tt>put</tt> method to return
|
||||
* <tt>null</tt> and the <tt>remove</tt> method to return
|
||||
* <tt>false</tt> for a key that previously appeared to be in the map, and
|
||||
* {@code WeakHashMap} instance and invoke none of its mutator methods, it
|
||||
* is possible for the {@code size} method to return smaller values over
|
||||
* time, for the {@code isEmpty} method to return {@code false} and
|
||||
* then {@code true}, for the {@code containsKey} method to return
|
||||
* {@code true} and later {@code false} for a given key, for the
|
||||
* {@code get} method to return a value for a given key but later return
|
||||
* {@code null}, for the {@code put} method to return
|
||||
* {@code null} and the {@code remove} method to return
|
||||
* {@code false} for a key that previously appeared to be in the map, and
|
||||
* for successive examinations of the key set, the value collection, and
|
||||
* the entry set to yield successively smaller numbers of elements.
|
||||
*
|
||||
* <p> Each key object in a <tt>WeakHashMap</tt> is stored indirectly as
|
||||
* <p> Each key object in a {@code WeakHashMap} is stored indirectly as
|
||||
* the referent of a weak reference. Therefore a key will automatically be
|
||||
* removed only after the weak references to it, both inside and outside of the
|
||||
* map, have been cleared by the garbage collector.
|
||||
*
|
||||
* <p> <strong>Implementation note:</strong> The value objects in a
|
||||
* <tt>WeakHashMap</tt> are held by ordinary strong references. Thus care
|
||||
* {@code WeakHashMap} are held by ordinary strong references. Thus care
|
||||
* should be taken to ensure that value objects do not strongly refer to their
|
||||
* own keys, either directly or indirectly, since that will prevent the keys
|
||||
* from being discarded. Note that a value object may refer indirectly to its
|
||||
* key via the <tt>WeakHashMap</tt> itself; that is, a value object may
|
||||
* key via the {@code WeakHashMap} itself; that is, a value object may
|
||||
* strongly refer to some other key object whose associated value object, in
|
||||
* turn, strongly refers to the key of the first value object. If the values
|
||||
* in the map do not rely on the map holding strong references to them, one way
|
||||
* to deal with this is to wrap values themselves within
|
||||
* <tt>WeakReferences</tt> before
|
||||
* inserting, as in: <tt>m.put(key, new WeakReference(value))</tt>,
|
||||
* and then unwrapping upon each <tt>get</tt>.
|
||||
* {@code WeakReferences} before
|
||||
* inserting, as in: {@code m.put(key, new WeakReference(value))},
|
||||
* and then unwrapping upon each {@code get}.
|
||||
*
|
||||
* <p>The iterators returned by the <tt>iterator</tt> method of the collections
|
||||
* <p>The iterators returned by the {@code iterator} method of the collections
|
||||
* returned by all of this class's "collection view methods" are
|
||||
* <i>fail-fast</i>: if the map is structurally modified at any time after the
|
||||
* iterator is created, in any way except through the iterator's own
|
||||
* <tt>remove</tt> method, the iterator will throw a {@link
|
||||
* {@code remove} method, the iterator will throw a {@link
|
||||
* ConcurrentModificationException}. Thus, in the face of concurrent
|
||||
* modification, the iterator fails quickly and cleanly, rather than risking
|
||||
* arbitrary, non-deterministic behavior at an undetermined time in the future.
|
||||
@ -114,7 +114,7 @@ import java.util.function.Consumer;
|
||||
* <p>Note that the fail-fast behavior of an iterator cannot be guaranteed
|
||||
* as it is, generally speaking, impossible to make any hard guarantees in the
|
||||
* presence of unsynchronized concurrent modification. Fail-fast iterators
|
||||
* throw <tt>ConcurrentModificationException</tt> on a best-effort basis.
|
||||
* throw {@code ConcurrentModificationException} on a best-effort basis.
|
||||
* Therefore, it would be wrong to write a program that depended on this
|
||||
* exception for its correctness: <i>the fail-fast behavior of iterators
|
||||
* should be used only to detect bugs.</i>
|
||||
@ -196,11 +196,11 @@ public class WeakHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new, empty <tt>WeakHashMap</tt> with the given initial
|
||||
* Constructs a new, empty {@code WeakHashMap} with the given initial
|
||||
* capacity and the given load factor.
|
||||
*
|
||||
* @param initialCapacity The initial capacity of the <tt>WeakHashMap</tt>
|
||||
* @param loadFactor The load factor of the <tt>WeakHashMap</tt>
|
||||
* @param initialCapacity The initial capacity of the {@code WeakHashMap}
|
||||
* @param loadFactor The load factor of the {@code WeakHashMap}
|
||||
* @throws IllegalArgumentException if the initial capacity is negative,
|
||||
* or if the load factor is nonpositive.
|
||||
*/
|
||||
@ -223,10 +223,10 @@ public class WeakHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new, empty <tt>WeakHashMap</tt> with the given initial
|
||||
* Constructs a new, empty {@code WeakHashMap} with the given initial
|
||||
* capacity and the default load factor (0.75).
|
||||
*
|
||||
* @param initialCapacity The initial capacity of the <tt>WeakHashMap</tt>
|
||||
* @param initialCapacity The initial capacity of the {@code WeakHashMap}
|
||||
* @throws IllegalArgumentException if the initial capacity is negative
|
||||
*/
|
||||
public WeakHashMap(int initialCapacity) {
|
||||
@ -234,7 +234,7 @@ public class WeakHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new, empty <tt>WeakHashMap</tt> with the default initial
|
||||
* Constructs a new, empty {@code WeakHashMap} with the default initial
|
||||
* capacity (16) and load factor (0.75).
|
||||
*/
|
||||
public WeakHashMap() {
|
||||
@ -242,8 +242,8 @@ public class WeakHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new <tt>WeakHashMap</tt> with the same mappings as the
|
||||
* specified map. The <tt>WeakHashMap</tt> is created with the default
|
||||
* Constructs a new {@code WeakHashMap} with the same mappings as the
|
||||
* specified map. The {@code WeakHashMap} is created with the default
|
||||
* load factor (0.75) and an initial capacity sufficient to hold the
|
||||
* mappings in the specified map.
|
||||
*
|
||||
@ -365,7 +365,7 @@ public class WeakHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map contains no key-value mappings.
|
||||
* Returns {@code true} if this map contains no key-value mappings.
|
||||
* This result is a snapshot, and may not reflect unprocessed
|
||||
* entries that will be removed before next attempted access
|
||||
* because they are no longer referenced.
|
||||
@ -379,8 +379,9 @@ public class WeakHashMap<K,V>
|
||||
* or {@code null} if this map contains no mapping for the key.
|
||||
*
|
||||
* <p>More formally, if this map contains a mapping from a key
|
||||
* {@code k} to a value {@code v} such that {@code (key==null ? k==null :
|
||||
* key.equals(k))}, then this method returns {@code v}; otherwise
|
||||
* {@code k} to a value {@code v} such that
|
||||
* {@code Objects.equals(key, k)},
|
||||
* then this method returns {@code v}; otherwise
|
||||
* it returns {@code null}. (There can be at most one such mapping.)
|
||||
*
|
||||
* <p>A return value of {@code null} does not <i>necessarily</i>
|
||||
@ -406,12 +407,12 @@ public class WeakHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map contains a mapping for the
|
||||
* Returns {@code true} if this map contains a mapping for the
|
||||
* specified key.
|
||||
*
|
||||
* @param key The key whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if there is a mapping for <tt>key</tt>;
|
||||
* <tt>false</tt> otherwise
|
||||
* @return {@code true} if there is a mapping for {@code key};
|
||||
* {@code false} otherwise
|
||||
*/
|
||||
public boolean containsKey(Object key) {
|
||||
return getEntry(key) != null;
|
||||
@ -439,10 +440,10 @@ public class WeakHashMap<K,V>
|
||||
*
|
||||
* @param key key with which the specified value is to be associated.
|
||||
* @param value value to be associated with the specified key.
|
||||
* @return the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>.
|
||||
* (A <tt>null</tt> return can also indicate that the map
|
||||
* previously associated <tt>null</tt> with <tt>key</tt>.)
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}.
|
||||
* (A {@code null} return can also indicate that the map
|
||||
* previously associated {@code null} with {@code key}.)
|
||||
*/
|
||||
public V put(K key, V value) {
|
||||
Object k = maskNull(key);
|
||||
@ -568,23 +569,23 @@ public class WeakHashMap<K,V>
|
||||
|
||||
/**
|
||||
* Removes the mapping for a key from this weak hash map if it is present.
|
||||
* More formally, if this map contains a mapping from key <tt>k</tt> to
|
||||
* value <tt>v</tt> such that <code>(key==null ? k==null :
|
||||
* More formally, if this map contains a mapping from key {@code k} to
|
||||
* value {@code v} such that <code>(key==null ? k==null :
|
||||
* key.equals(k))</code>, that mapping is removed. (The map can contain
|
||||
* at most one such mapping.)
|
||||
*
|
||||
* <p>Returns the value to which this map previously associated the key,
|
||||
* or <tt>null</tt> if the map contained no mapping for the key. A
|
||||
* return value of <tt>null</tt> does not <i>necessarily</i> indicate
|
||||
* or {@code null} if the map contained no mapping for the key. A
|
||||
* return value of {@code null} does not <i>necessarily</i> indicate
|
||||
* that the map contained no mapping for the key; it's also possible
|
||||
* that the map explicitly mapped the key to <tt>null</tt>.
|
||||
* that the map explicitly mapped the key to {@code null}.
|
||||
*
|
||||
* <p>The map will not contain a mapping for the specified key once the
|
||||
* call returns.
|
||||
*
|
||||
* @param key key whose mapping is to be removed from the map
|
||||
* @return the previous value associated with <tt>key</tt>, or
|
||||
* <tt>null</tt> if there was no mapping for <tt>key</tt>
|
||||
* @return the previous value associated with {@code key}, or
|
||||
* {@code null} if there was no mapping for {@code key}
|
||||
*/
|
||||
public V remove(Object key) {
|
||||
Object k = maskNull(key);
|
||||
@ -664,11 +665,11 @@ public class WeakHashMap<K,V>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns <tt>true</tt> if this map maps one or more keys to the
|
||||
* Returns {@code true} if this map maps one or more keys to the
|
||||
* specified value.
|
||||
*
|
||||
* @param value value whose presence in this map is to be tested
|
||||
* @return <tt>true</tt> if this map maps one or more keys to the
|
||||
* @return {@code true} if this map maps one or more keys to the
|
||||
* specified value
|
||||
*/
|
||||
public boolean containsValue(Object value) {
|
||||
@ -855,12 +856,12 @@ public class WeakHashMap<K,V>
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation), the results of
|
||||
* the iterator's own {@code remove} operation), the results of
|
||||
* the iteration are undefined. The set supports element removal,
|
||||
* which removes the corresponding mapping from the map, via the
|
||||
* <tt>Iterator.remove</tt>, <tt>Set.remove</tt>,
|
||||
* <tt>removeAll</tt>, <tt>retainAll</tt>, and <tt>clear</tt>
|
||||
* operations. It does not support the <tt>add</tt> or <tt>addAll</tt>
|
||||
* {@code Iterator.remove}, {@code Set.remove},
|
||||
* {@code removeAll}, {@code retainAll}, and {@code clear}
|
||||
* operations. It does not support the {@code add} or {@code addAll}
|
||||
* operations.
|
||||
*/
|
||||
public Set<K> keySet() {
|
||||
@ -904,13 +905,13 @@ public class WeakHashMap<K,V>
|
||||
* The collection is backed by the map, so changes to the map are
|
||||
* reflected in the collection, and vice-versa. If the map is
|
||||
* modified while an iteration over the collection is in progress
|
||||
* (except through the iterator's own <tt>remove</tt> operation),
|
||||
* (except through the iterator's own {@code remove} operation),
|
||||
* the results of the iteration are undefined. The collection
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Collection.remove</tt>, <tt>removeAll</tt>,
|
||||
* <tt>retainAll</tt> and <tt>clear</tt> operations. It does not
|
||||
* support the <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Collection.remove}, {@code removeAll},
|
||||
* {@code retainAll} and {@code clear} operations. It does not
|
||||
* support the {@code add} or {@code addAll} operations.
|
||||
*/
|
||||
public Collection<V> values() {
|
||||
Collection<V> vs = values;
|
||||
@ -944,14 +945,14 @@ public class WeakHashMap<K,V>
|
||||
* The set is backed by the map, so changes to the map are
|
||||
* reflected in the set, and vice-versa. If the map is modified
|
||||
* while an iteration over the set is in progress (except through
|
||||
* the iterator's own <tt>remove</tt> operation, or through the
|
||||
* <tt>setValue</tt> operation on a map entry returned by the
|
||||
* the iterator's own {@code remove} operation, or through the
|
||||
* {@code setValue} operation on a map entry returned by the
|
||||
* iterator) the results of the iteration are undefined. The set
|
||||
* supports element removal, which removes the corresponding
|
||||
* mapping from the map, via the <tt>Iterator.remove</tt>,
|
||||
* <tt>Set.remove</tt>, <tt>removeAll</tt>, <tt>retainAll</tt> and
|
||||
* <tt>clear</tt> operations. It does not support the
|
||||
* <tt>add</tt> or <tt>addAll</tt> operations.
|
||||
* mapping from the map, via the {@code Iterator.remove},
|
||||
* {@code Set.remove}, {@code removeAll}, {@code retainAll} and
|
||||
* {@code clear} operations. It does not support the
|
||||
* {@code add} or {@code addAll} operations.
|
||||
*/
|
||||
public Set<Map.Entry<K,V>> entrySet() {
|
||||
Set<Map.Entry<K,V>> es = entrySet;
|
||||
|
||||
@ -31,7 +31,7 @@ package java.util.regex;
|
||||
* <p>This interface contains query methods used to determine the
|
||||
* results of a match against a regular expression. The match boundaries,
|
||||
* groups and group boundaries can be seen but not modified through
|
||||
* a <code>MatchResult</code>.
|
||||
* a {@code MatchResult}.
|
||||
*
|
||||
* @author Michael McCloskey
|
||||
* @see Matcher
|
||||
@ -56,14 +56,14 @@ public interface MatchResult {
|
||||
*
|
||||
* <p> <a href="Pattern.html#cg">Capturing groups</a> are indexed from left
|
||||
* to right, starting at one. Group zero denotes the entire pattern, so
|
||||
* the expression <i>m.</i><tt>start(0)</tt> is equivalent to
|
||||
* <i>m.</i><tt>start()</tt>. </p>
|
||||
* the expression <i>m.</i>{@code start(0)} is equivalent to
|
||||
* <i>m.</i>{@code start()}. </p>
|
||||
*
|
||||
* @param group
|
||||
* The index of a capturing group in this matcher's pattern
|
||||
*
|
||||
* @return The index of the first character captured by the group,
|
||||
* or <tt>-1</tt> if the match was successful but the group
|
||||
* or {@code -1} if the match was successful but the group
|
||||
* itself did not match anything
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
@ -93,14 +93,14 @@ public interface MatchResult {
|
||||
*
|
||||
* <p> <a href="Pattern.html#cg">Capturing groups</a> are indexed from left
|
||||
* to right, starting at one. Group zero denotes the entire pattern, so
|
||||
* the expression <i>m.</i><tt>end(0)</tt> is equivalent to
|
||||
* <i>m.</i><tt>end()</tt>. </p>
|
||||
* the expression <i>m.</i>{@code end(0)} is equivalent to
|
||||
* <i>m.</i>{@code end()}. </p>
|
||||
*
|
||||
* @param group
|
||||
* The index of a capturing group in this matcher's pattern
|
||||
*
|
||||
* @return The offset after the last character captured by the group,
|
||||
* or <tt>-1</tt> if the match was successful
|
||||
* or {@code -1} if the match was successful
|
||||
* but the group itself did not match anything
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
@ -117,11 +117,11 @@ public interface MatchResult {
|
||||
* Returns the input subsequence matched by the previous match.
|
||||
*
|
||||
* <p> For a matcher <i>m</i> with input sequence <i>s</i>,
|
||||
* the expressions <i>m.</i><tt>group()</tt> and
|
||||
* <i>s.</i><tt>substring(</tt><i>m.</i><tt>start(),</tt> <i>m.</i><tt>end())</tt>
|
||||
* the expressions <i>m.</i>{@code group()} and
|
||||
* <i>s.</i>{@code substring(}<i>m.</i>{@code start(),} <i>m.</i>{@code end())}
|
||||
* are equivalent. </p>
|
||||
*
|
||||
* <p> Note that some patterns, for example <tt>a*</tt>, match the empty
|
||||
* <p> Note that some patterns, for example {@code a*}, match the empty
|
||||
* string. This method will return the empty string when the pattern
|
||||
* successfully matches the empty string in the input. </p>
|
||||
*
|
||||
@ -139,18 +139,19 @@ public interface MatchResult {
|
||||
* previous match operation.
|
||||
*
|
||||
* <p> For a matcher <i>m</i>, input sequence <i>s</i>, and group index
|
||||
* <i>g</i>, the expressions <i>m.</i><tt>group(</tt><i>g</i><tt>)</tt> and
|
||||
* <i>s.</i><tt>substring(</tt><i>m.</i><tt>start(</tt><i>g</i><tt>),</tt> <i>m.</i><tt>end(</tt><i>g</i><tt>))</tt>
|
||||
* <i>g</i>, the expressions <i>m.</i>{@code group(}<i>g</i>{@code )} and
|
||||
* <i>s.</i>{@code substring(}<i>m.</i>{@code start(}<i>g</i>{@code
|
||||
* ),} <i>m.</i>{@code end(}<i>g</i>{@code ))}
|
||||
* are equivalent. </p>
|
||||
*
|
||||
* <p> <a href="Pattern.html#cg">Capturing groups</a> are indexed from left
|
||||
* to right, starting at one. Group zero denotes the entire pattern, so
|
||||
* the expression <tt>m.group(0)</tt> is equivalent to <tt>m.group()</tt>.
|
||||
* the expression {@code m.group(0)} is equivalent to {@code m.group()}.
|
||||
* </p>
|
||||
*
|
||||
* <p> If the match was successful but the group specified failed to match
|
||||
* any part of the input sequence, then <tt>null</tt> is returned. Note
|
||||
* that some groups, for example <tt>(a*)</tt>, match the empty string.
|
||||
* any part of the input sequence, then {@code null} is returned. Note
|
||||
* that some groups, for example {@code (a*)}, match the empty string.
|
||||
* This method will return the empty string when such a group successfully
|
||||
* matches the empty string in the input. </p>
|
||||
*
|
||||
@ -158,7 +159,7 @@ public interface MatchResult {
|
||||
* The index of a capturing group in this matcher's pattern
|
||||
*
|
||||
* @return The (possibly empty) subsequence captured by the group
|
||||
* during the previous match, or <tt>null</tt> if the group
|
||||
* during the previous match, or {@code null} if the group
|
||||
* failed to match part of the input
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
|
||||
@ -258,7 +258,7 @@ public final class Matcher implements MatchResult {
|
||||
* The result is unaffected by subsequent operations performed upon this
|
||||
* matcher.
|
||||
*
|
||||
* @return a <code>MatchResult</code> with the state of this matcher
|
||||
* @return a {@code MatchResult} with the state of this matcher
|
||||
* @since 1.5
|
||||
*/
|
||||
public MatchResult toMatchResult() {
|
||||
@ -347,7 +347,7 @@ public final class Matcher implements MatchResult {
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the <tt>Pattern</tt> that this <tt>Matcher</tt> uses to
|
||||
* Changes the {@code Pattern} that this {@code Matcher} uses to
|
||||
* find matches with.
|
||||
*
|
||||
* <p> This method causes this matcher to lose information
|
||||
@ -359,7 +359,7 @@ public final class Matcher implements MatchResult {
|
||||
* The new pattern used by this matcher
|
||||
* @return This matcher
|
||||
* @throws IllegalArgumentException
|
||||
* If newPattern is <tt>null</tt>
|
||||
* If newPattern is {@code null}
|
||||
* @since 1.5
|
||||
*/
|
||||
public Matcher usePattern(Pattern newPattern) {
|
||||
@ -444,14 +444,14 @@ public final class Matcher implements MatchResult {
|
||||
*
|
||||
* <p> <a href="Pattern.html#cg">Capturing groups</a> are indexed from left
|
||||
* to right, starting at one. Group zero denotes the entire pattern, so
|
||||
* the expression <i>m.</i><tt>start(0)</tt> is equivalent to
|
||||
* <i>m.</i><tt>start()</tt>. </p>
|
||||
* the expression <i>m.</i>{@code start(0)} is equivalent to
|
||||
* <i>m.</i>{@code start()}. </p>
|
||||
*
|
||||
* @param group
|
||||
* The index of a capturing group in this matcher's pattern
|
||||
*
|
||||
* @return The index of the first character captured by the group,
|
||||
* or <tt>-1</tt> if the match was successful but the group
|
||||
* or {@code -1} if the match was successful but the group
|
||||
* itself did not match anything
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
@ -516,14 +516,14 @@ public final class Matcher implements MatchResult {
|
||||
*
|
||||
* <p> <a href="Pattern.html#cg">Capturing groups</a> are indexed from left
|
||||
* to right, starting at one. Group zero denotes the entire pattern, so
|
||||
* the expression <i>m.</i><tt>end(0)</tt> is equivalent to
|
||||
* <i>m.</i><tt>end()</tt>. </p>
|
||||
* the expression <i>m.</i>{@code end(0)} is equivalent to
|
||||
* <i>m.</i>{@code end()}. </p>
|
||||
*
|
||||
* @param group
|
||||
* The index of a capturing group in this matcher's pattern
|
||||
*
|
||||
* @return The offset after the last character captured by the group,
|
||||
* or <tt>-1</tt> if the match was successful
|
||||
* or {@code -1} if the match was successful
|
||||
* but the group itself did not match anything
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
@ -571,11 +571,11 @@ public final class Matcher implements MatchResult {
|
||||
* Returns the input subsequence matched by the previous match.
|
||||
*
|
||||
* <p> For a matcher <i>m</i> with input sequence <i>s</i>,
|
||||
* the expressions <i>m.</i><tt>group()</tt> and
|
||||
* <i>s.</i><tt>substring(</tt><i>m.</i><tt>start(),</tt> <i>m.</i><tt>end())</tt>
|
||||
* the expressions <i>m.</i>{@code group()} and
|
||||
* <i>s.</i>{@code substring(}<i>m.</i>{@code start(),} <i>m.</i>{@code end())}
|
||||
* are equivalent. </p>
|
||||
*
|
||||
* <p> Note that some patterns, for example <tt>a*</tt>, match the empty
|
||||
* <p> Note that some patterns, for example {@code a*}, match the empty
|
||||
* string. This method will return the empty string when the pattern
|
||||
* successfully matches the empty string in the input. </p>
|
||||
*
|
||||
@ -595,18 +595,19 @@ public final class Matcher implements MatchResult {
|
||||
* previous match operation.
|
||||
*
|
||||
* <p> For a matcher <i>m</i>, input sequence <i>s</i>, and group index
|
||||
* <i>g</i>, the expressions <i>m.</i><tt>group(</tt><i>g</i><tt>)</tt> and
|
||||
* <i>s.</i><tt>substring(</tt><i>m.</i><tt>start(</tt><i>g</i><tt>),</tt> <i>m.</i><tt>end(</tt><i>g</i><tt>))</tt>
|
||||
* <i>g</i>, the expressions <i>m.</i>{@code group(}<i>g</i>{@code )} and
|
||||
* <i>s.</i>{@code substring(}<i>m.</i>{@code start(}<i>g</i>{@code
|
||||
* ),} <i>m.</i>{@code end(}<i>g</i>{@code ))}
|
||||
* are equivalent. </p>
|
||||
*
|
||||
* <p> <a href="Pattern.html#cg">Capturing groups</a> are indexed from left
|
||||
* to right, starting at one. Group zero denotes the entire pattern, so
|
||||
* the expression <tt>m.group(0)</tt> is equivalent to <tt>m.group()</tt>.
|
||||
* the expression {@code m.group(0)} is equivalent to {@code m.group()}.
|
||||
* </p>
|
||||
*
|
||||
* <p> If the match was successful but the group specified failed to match
|
||||
* any part of the input sequence, then <tt>null</tt> is returned. Note
|
||||
* that some groups, for example <tt>(a*)</tt>, match the empty string.
|
||||
* any part of the input sequence, then {@code null} is returned. Note
|
||||
* that some groups, for example {@code (a*)}, match the empty string.
|
||||
* This method will return the empty string when such a group successfully
|
||||
* matches the empty string in the input. </p>
|
||||
*
|
||||
@ -614,7 +615,7 @@ public final class Matcher implements MatchResult {
|
||||
* The index of a capturing group in this matcher's pattern
|
||||
*
|
||||
* @return The (possibly empty) subsequence captured by the group
|
||||
* during the previous match, or <tt>null</tt> if the group
|
||||
* during the previous match, or {@code null} if the group
|
||||
* failed to match part of the input
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
@ -641,8 +642,8 @@ public final class Matcher implements MatchResult {
|
||||
* match operation.
|
||||
*
|
||||
* <p> If the match was successful but the group specified failed to match
|
||||
* any part of the input sequence, then <tt>null</tt> is returned. Note
|
||||
* that some groups, for example <tt>(a*)</tt>, match the empty string.
|
||||
* any part of the input sequence, then {@code null} is returned. Note
|
||||
* that some groups, for example {@code (a*)}, match the empty string.
|
||||
* This method will return the empty string when such a group successfully
|
||||
* matches the empty string in the input. </p>
|
||||
*
|
||||
@ -650,7 +651,7 @@ public final class Matcher implements MatchResult {
|
||||
* The name of a named-capturing group in this matcher's pattern
|
||||
*
|
||||
* @return The (possibly empty) subsequence captured by the named group
|
||||
* during the previous match, or <tt>null</tt> if the group
|
||||
* during the previous match, or {@code null} if the group
|
||||
* failed to match part of the input
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
@ -689,9 +690,9 @@ public final class Matcher implements MatchResult {
|
||||
* Attempts to match the entire region against the pattern.
|
||||
*
|
||||
* <p> If the match succeeds then more information can be obtained via the
|
||||
* <tt>start</tt>, <tt>end</tt>, and <tt>group</tt> methods. </p>
|
||||
* {@code start}, {@code end}, and {@code group} methods. </p>
|
||||
*
|
||||
* @return <tt>true</tt> if, and only if, the entire region sequence
|
||||
* @return {@code true} if, and only if, the entire region sequence
|
||||
* matches this matcher's pattern
|
||||
*/
|
||||
public boolean matches() {
|
||||
@ -708,9 +709,9 @@ public final class Matcher implements MatchResult {
|
||||
* match.
|
||||
*
|
||||
* <p> If the match succeeds then more information can be obtained via the
|
||||
* <tt>start</tt>, <tt>end</tt>, and <tt>group</tt> methods. </p>
|
||||
* {@code start}, {@code end}, and {@code group} methods. </p>
|
||||
*
|
||||
* @return <tt>true</tt> if, and only if, a subsequence of the input
|
||||
* @return {@code true} if, and only if, a subsequence of the input
|
||||
* sequence matches this matcher's pattern
|
||||
*/
|
||||
public boolean find() {
|
||||
@ -737,7 +738,7 @@ public final class Matcher implements MatchResult {
|
||||
* index.
|
||||
*
|
||||
* <p> If the match succeeds then more information can be obtained via the
|
||||
* <tt>start</tt>, <tt>end</tt>, and <tt>group</tt> methods, and subsequent
|
||||
* {@code start}, {@code end}, and {@code group} methods, and subsequent
|
||||
* invocations of the {@link #find()} method will start at the first
|
||||
* character not matched by this match. </p>
|
||||
*
|
||||
@ -746,7 +747,7 @@ public final class Matcher implements MatchResult {
|
||||
* If start is less than zero or if start is greater than the
|
||||
* length of the input sequence.
|
||||
*
|
||||
* @return <tt>true</tt> if, and only if, a subsequence of the input
|
||||
* @return {@code true} if, and only if, a subsequence of the input
|
||||
* sequence starting at the given index matches this matcher's
|
||||
* pattern
|
||||
*/
|
||||
@ -767,9 +768,9 @@ public final class Matcher implements MatchResult {
|
||||
* require that the entire region be matched.
|
||||
*
|
||||
* <p> If the match succeeds then more information can be obtained via the
|
||||
* <tt>start</tt>, <tt>end</tt>, and <tt>group</tt> methods. </p>
|
||||
* {@code start}, {@code end}, and {@code group} methods. </p>
|
||||
*
|
||||
* @return <tt>true</tt> if, and only if, a prefix of the input
|
||||
* @return {@code true} if, and only if, a prefix of the input
|
||||
* sequence matches this matcher's pattern
|
||||
*/
|
||||
public boolean lookingAt() {
|
||||
@ -777,14 +778,14 @@ public final class Matcher implements MatchResult {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a literal replacement <code>String</code> for the specified
|
||||
* <code>String</code>.
|
||||
* Returns a literal replacement {@code String} for the specified
|
||||
* {@code String}.
|
||||
*
|
||||
* This method produces a <code>String</code> that will work
|
||||
* as a literal replacement <code>s</code> in the
|
||||
* <code>appendReplacement</code> method of the {@link Matcher} class.
|
||||
* The <code>String</code> produced will match the sequence of characters
|
||||
* in <code>s</code> treated as a literal sequence. Slashes ('\') and
|
||||
* This method produces a {@code String} that will work
|
||||
* as a literal replacement {@code s} in the
|
||||
* {@code appendReplacement} method of the {@link Matcher} class.
|
||||
* The {@code String} produced will match the sequence of characters
|
||||
* in {@code s} treated as a literal sequence. Slashes ('\') and
|
||||
* dollar signs ('$') will be given no special meaning.
|
||||
*
|
||||
* @param s The string to be literalized
|
||||
@ -816,7 +817,7 @@ public final class Matcher implements MatchResult {
|
||||
* append position, and appends them to the given string buffer. It
|
||||
* stops after reading the last character preceding the previous match,
|
||||
* that is, the character at index {@link
|
||||
* #start()} <tt>-</tt> <tt>1</tt>. </p></li>
|
||||
* #start()} {@code -} {@code 1}. </p></li>
|
||||
*
|
||||
* <li><p> It appends the given replacement string to the string buffer.
|
||||
* </p></li>
|
||||
@ -829,21 +830,21 @@ public final class Matcher implements MatchResult {
|
||||
*
|
||||
* <p> The replacement string may contain references to subsequences
|
||||
* captured during the previous match: Each occurrence of
|
||||
* <tt>${</tt><i>name</i><tt>}</tt> or <tt>$</tt><i>g</i>
|
||||
* <code>${</code><i>name</i><code>}</code> or {@code $}<i>g</i>
|
||||
* will be replaced by the result of evaluating the corresponding
|
||||
* {@link #group(String) group(name)} or {@link #group(int) group(g)}
|
||||
* respectively. For <tt>$</tt><i>g</i>,
|
||||
* the first number after the <tt>$</tt> is always treated as part of
|
||||
* respectively. For {@code $}<i>g</i>,
|
||||
* the first number after the {@code $} is always treated as part of
|
||||
* the group reference. Subsequent numbers are incorporated into g if
|
||||
* they would form a legal group reference. Only the numerals '0'
|
||||
* through '9' are considered as potential components of the group
|
||||
* reference. If the second group matched the string <tt>"foo"</tt>, for
|
||||
* example, then passing the replacement string <tt>"$2bar"</tt> would
|
||||
* cause <tt>"foobar"</tt> to be appended to the string buffer. A dollar
|
||||
* sign (<tt>$</tt>) may be included as a literal in the replacement
|
||||
* string by preceding it with a backslash (<tt>\$</tt>).
|
||||
* reference. If the second group matched the string {@code "foo"}, for
|
||||
* example, then passing the replacement string {@code "$2bar"} would
|
||||
* cause {@code "foobar"} to be appended to the string buffer. A dollar
|
||||
* sign ({@code $}) may be included as a literal in the replacement
|
||||
* string by preceding it with a backslash ({@code \$}).
|
||||
*
|
||||
* <p> Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
|
||||
* <p> Note that backslashes ({@code \}) and dollar signs ({@code $}) in
|
||||
* the replacement string may cause the results to be different than if it
|
||||
* were being treated as a literal replacement string. Dollar signs may be
|
||||
* treated as references to captured subsequences as described above, and
|
||||
@ -852,8 +853,8 @@ public final class Matcher implements MatchResult {
|
||||
*
|
||||
* <p> This method is intended to be used in a loop together with the
|
||||
* {@link #appendTail appendTail} and {@link #find find} methods. The
|
||||
* following code, for example, writes <tt>one dog two dogs in the
|
||||
* yard</tt> to the standard-output stream: </p>
|
||||
* following code, for example, writes {@code one dog two dogs in the
|
||||
* yard} to the standard-output stream: </p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* Pattern p = Pattern.compile("cat");
|
||||
@ -911,7 +912,7 @@ public final class Matcher implements MatchResult {
|
||||
* append position, and appends them to the given string builder. It
|
||||
* stops after reading the last character preceding the previous match,
|
||||
* that is, the character at index {@link
|
||||
* #start()} <tt>-</tt> <tt>1</tt>. </p></li>
|
||||
* #start()} {@code -} {@code 1}. </p></li>
|
||||
*
|
||||
* <li><p> It appends the given replacement string to the string builder.
|
||||
* </p></li>
|
||||
@ -924,19 +925,19 @@ public final class Matcher implements MatchResult {
|
||||
*
|
||||
* <p> The replacement string may contain references to subsequences
|
||||
* captured during the previous match: Each occurrence of
|
||||
* <tt>$</tt><i>g</i> will be replaced by the result of
|
||||
* evaluating {@link #group(int) group}<tt>(</tt><i>g</i><tt>)</tt>.
|
||||
* The first number after the <tt>$</tt> is always treated as part of
|
||||
* {@code $}<i>g</i> will be replaced by the result of
|
||||
* evaluating {@link #group(int) group}{@code (}<i>g</i>{@code )}.
|
||||
* The first number after the {@code $} is always treated as part of
|
||||
* the group reference. Subsequent numbers are incorporated into g if
|
||||
* they would form a legal group reference. Only the numerals '0'
|
||||
* through '9' are considered as potential components of the group
|
||||
* reference. If the second group matched the string <tt>"foo"</tt>, for
|
||||
* example, then passing the replacement string <tt>"$2bar"</tt> would
|
||||
* cause <tt>"foobar"</tt> to be appended to the string builder. A dollar
|
||||
* sign (<tt>$</tt>) may be included as a literal in the replacement
|
||||
* string by preceding it with a backslash (<tt>\$</tt>).
|
||||
* reference. If the second group matched the string {@code "foo"}, for
|
||||
* example, then passing the replacement string {@code "$2bar"} would
|
||||
* cause {@code "foobar"} to be appended to the string builder. A dollar
|
||||
* sign ({@code $}) may be included as a literal in the replacement
|
||||
* string by preceding it with a backslash ({@code \$}).
|
||||
*
|
||||
* <p> Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
|
||||
* <p> Note that backslashes ({@code \}) and dollar signs ({@code $}) in
|
||||
* the replacement string may cause the results to be different than if it
|
||||
* were being treated as a literal replacement string. Dollar signs may be
|
||||
* treated as references to captured subsequences as described above, and
|
||||
@ -945,8 +946,8 @@ public final class Matcher implements MatchResult {
|
||||
*
|
||||
* <p> This method is intended to be used in a loop together with the
|
||||
* {@link #appendTail appendTail} and {@link #find find} methods. The
|
||||
* following code, for example, writes <tt>one dog two dogs in the
|
||||
* yard</tt> to the standard-output stream: </p>
|
||||
* following code, for example, writes {@code one dog two dogs in the
|
||||
* yard} to the standard-output stream: </p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* Pattern p = Pattern.compile("cat");
|
||||
@ -1134,17 +1135,17 @@ public final class Matcher implements MatchResult {
|
||||
* string may contain references to captured subsequences as in the {@link
|
||||
* #appendReplacement appendReplacement} method.
|
||||
*
|
||||
* <p> Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
|
||||
* <p> Note that backslashes ({@code \}) and dollar signs ({@code $}) in
|
||||
* the replacement string may cause the results to be different than if it
|
||||
* were being treated as a literal replacement string. Dollar signs may be
|
||||
* treated as references to captured subsequences as described above, and
|
||||
* backslashes are used to escape literal characters in the replacement
|
||||
* string.
|
||||
*
|
||||
* <p> Given the regular expression <tt>a*b</tt>, the input
|
||||
* <tt>"aabfooaabfooabfoob"</tt>, and the replacement string
|
||||
* <tt>"-"</tt>, an invocation of this method on a matcher for that
|
||||
* expression would yield the string <tt>"-foo-foo-foo-"</tt>.
|
||||
* <p> Given the regular expression {@code a*b}, the input
|
||||
* {@code "aabfooaabfooabfoob"}, and the replacement string
|
||||
* {@code "-"}, an invocation of this method on a matcher for that
|
||||
* expression would yield the string {@code "-foo-foo-foo-"}.
|
||||
*
|
||||
* <p> Invoking this method changes this matcher's state. If the matcher
|
||||
* is to be used in further matching operations then it should first be
|
||||
@ -1186,18 +1187,18 @@ public final class Matcher implements MatchResult {
|
||||
* references to captured subsequences as in the {@link #appendReplacement
|
||||
* appendReplacement} method.
|
||||
*
|
||||
* <p> Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
|
||||
* <p> Note that backslashes ({@code \}) and dollar signs ({@code $}) in
|
||||
* a replacement string may cause the results to be different than if it
|
||||
* were being treated as a literal replacement string. Dollar signs may be
|
||||
* treated as references to captured subsequences as described above, and
|
||||
* backslashes are used to escape literal characters in the replacement
|
||||
* string.
|
||||
*
|
||||
* <p> Given the regular expression <tt>dog</tt>, the input
|
||||
* <tt>"zzzdogzzzdogzzz"</tt>, and the function
|
||||
* <p> Given the regular expression {@code dog}, the input
|
||||
* {@code "zzzdogzzzdogzzz"}, and the function
|
||||
* {@code mr -> mr.group().toUpperCase()}, an invocation of this method on
|
||||
* a matcher for that expression would yield the string
|
||||
* <tt>"zzzDOGzzzDOGzzz"</tt>.
|
||||
* {@code "zzzDOGzzzDOGzzz"}.
|
||||
*
|
||||
* <p> Invoking this method changes this matcher's state. If the matcher
|
||||
* is to be used in further matching operations then it should first be
|
||||
@ -1360,17 +1361,17 @@ public final class Matcher implements MatchResult {
|
||||
* string may contain references to captured subsequences as in the {@link
|
||||
* #appendReplacement appendReplacement} method.
|
||||
*
|
||||
* <p>Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
|
||||
* <p>Note that backslashes ({@code \}) and dollar signs ({@code $}) in
|
||||
* the replacement string may cause the results to be different than if it
|
||||
* were being treated as a literal replacement string. Dollar signs may be
|
||||
* treated as references to captured subsequences as described above, and
|
||||
* backslashes are used to escape literal characters in the replacement
|
||||
* string.
|
||||
*
|
||||
* <p> Given the regular expression <tt>dog</tt>, the input
|
||||
* <tt>"zzzdogzzzdogzzz"</tt>, and the replacement string
|
||||
* <tt>"cat"</tt>, an invocation of this method on a matcher for that
|
||||
* expression would yield the string <tt>"zzzcatzzzdogzzz"</tt>. </p>
|
||||
* <p> Given the regular expression {@code dog}, the input
|
||||
* {@code "zzzdogzzzdogzzz"}, and the replacement string
|
||||
* {@code "cat"}, an invocation of this method on a matcher for that
|
||||
* expression would yield the string {@code "zzzcatzzzdogzzz"}. </p>
|
||||
*
|
||||
* <p> Invoking this method changes this matcher's state. If the matcher
|
||||
* is to be used in further matching operations then it should first be
|
||||
@ -1408,18 +1409,18 @@ public final class Matcher implements MatchResult {
|
||||
* references to captured subsequences as in the {@link #appendReplacement
|
||||
* appendReplacement} method.
|
||||
*
|
||||
* <p>Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
|
||||
* <p>Note that backslashes ({@code \}) and dollar signs ({@code $}) in
|
||||
* the replacement string may cause the results to be different than if it
|
||||
* were being treated as a literal replacement string. Dollar signs may be
|
||||
* treated as references to captured subsequences as described above, and
|
||||
* backslashes are used to escape literal characters in the replacement
|
||||
* string.
|
||||
*
|
||||
* <p> Given the regular expression <tt>dog</tt>, the input
|
||||
* <tt>"zzzdogzzzdogzzz"</tt>, and the function
|
||||
* <p> Given the regular expression {@code dog}, the input
|
||||
* {@code "zzzdogzzzdogzzz"}, and the function
|
||||
* {@code mr -> mr.group().toUpperCase()}, an invocation of this method on
|
||||
* a matcher for that expression would yield the string
|
||||
* <tt>"zzzDOGzzzdogzzz"</tt>.
|
||||
* {@code "zzzDOGzzzdogzzz"}.
|
||||
*
|
||||
* <p> Invoking this method changes this matcher's state. If the matcher
|
||||
* is to be used in further matching operations then it should first be
|
||||
@ -1471,8 +1472,8 @@ public final class Matcher implements MatchResult {
|
||||
* Sets the limits of this matcher's region. The region is the part of the
|
||||
* input sequence that will be searched to find a match. Invoking this
|
||||
* method resets the matcher, and then sets the region to start at the
|
||||
* index specified by the <code>start</code> parameter and end at the
|
||||
* index specified by the <code>end</code> parameter.
|
||||
* index specified by the {@code start} parameter and end at the
|
||||
* index specified by the {@code end} parameter.
|
||||
*
|
||||
* <p>Depending on the transparency and anchoring being used (see
|
||||
* {@link #useTransparentBounds useTransparentBounds} and
|
||||
@ -1534,8 +1535,8 @@ public final class Matcher implements MatchResult {
|
||||
/**
|
||||
* Queries the transparency of region bounds for this matcher.
|
||||
*
|
||||
* <p> This method returns <tt>true</tt> if this matcher uses
|
||||
* <i>transparent</i> bounds, <tt>false</tt> if it uses <i>opaque</i>
|
||||
* <p> This method returns {@code true} if this matcher uses
|
||||
* <i>transparent</i> bounds, {@code false} if it uses <i>opaque</i>
|
||||
* bounds.
|
||||
*
|
||||
* <p> See {@link #useTransparentBounds useTransparentBounds} for a
|
||||
@ -1543,8 +1544,8 @@ public final class Matcher implements MatchResult {
|
||||
*
|
||||
* <p> By default, a matcher uses opaque region boundaries.
|
||||
*
|
||||
* @return <tt>true</tt> iff this matcher is using transparent bounds,
|
||||
* <tt>false</tt> otherwise.
|
||||
* @return {@code true} iff this matcher is using transparent bounds,
|
||||
* {@code false} otherwise.
|
||||
* @see java.util.regex.Matcher#useTransparentBounds(boolean)
|
||||
* @since 1.5
|
||||
*/
|
||||
@ -1555,9 +1556,9 @@ public final class Matcher implements MatchResult {
|
||||
/**
|
||||
* Sets the transparency of region bounds for this matcher.
|
||||
*
|
||||
* <p> Invoking this method with an argument of <tt>true</tt> will set this
|
||||
* <p> Invoking this method with an argument of {@code true} will set this
|
||||
* matcher to use <i>transparent</i> bounds. If the boolean
|
||||
* argument is <tt>false</tt>, then <i>opaque</i> bounds will be used.
|
||||
* argument is {@code false}, then <i>opaque</i> bounds will be used.
|
||||
*
|
||||
* <p> Using transparent bounds, the boundaries of this
|
||||
* matcher's region are transparent to lookahead, lookbehind,
|
||||
@ -1586,16 +1587,16 @@ public final class Matcher implements MatchResult {
|
||||
/**
|
||||
* Queries the anchoring of region bounds for this matcher.
|
||||
*
|
||||
* <p> This method returns <tt>true</tt> if this matcher uses
|
||||
* <i>anchoring</i> bounds, <tt>false</tt> otherwise.
|
||||
* <p> This method returns {@code true} if this matcher uses
|
||||
* <i>anchoring</i> bounds, {@code false} otherwise.
|
||||
*
|
||||
* <p> See {@link #useAnchoringBounds useAnchoringBounds} for a
|
||||
* description of anchoring bounds.
|
||||
*
|
||||
* <p> By default, a matcher uses anchoring region boundaries.
|
||||
*
|
||||
* @return <tt>true</tt> iff this matcher is using anchoring bounds,
|
||||
* <tt>false</tt> otherwise.
|
||||
* @return {@code true} iff this matcher is using anchoring bounds,
|
||||
* {@code false} otherwise.
|
||||
* @see java.util.regex.Matcher#useAnchoringBounds(boolean)
|
||||
* @since 1.5
|
||||
*/
|
||||
@ -1606,9 +1607,9 @@ public final class Matcher implements MatchResult {
|
||||
/**
|
||||
* Sets the anchoring of region bounds for this matcher.
|
||||
*
|
||||
* <p> Invoking this method with an argument of <tt>true</tt> will set this
|
||||
* <p> Invoking this method with an argument of {@code true} will set this
|
||||
* matcher to use <i>anchoring</i> bounds. If the boolean
|
||||
* argument is <tt>false</tt>, then <i>non-anchoring</i> bounds will be
|
||||
* argument is {@code false}, then <i>non-anchoring</i> bounds will be
|
||||
* used.
|
||||
*
|
||||
* <p> Using anchoring bounds, the boundaries of this
|
||||
@ -1631,7 +1632,7 @@ public final class Matcher implements MatchResult {
|
||||
|
||||
/**
|
||||
* <p>Returns the string representation of this matcher. The
|
||||
* string representation of a <code>Matcher</code> contains information
|
||||
* string representation of a {@code Matcher} contains information
|
||||
* that may be useful for debugging. The exact format is unspecified.
|
||||
*
|
||||
* @return The string representation of this matcher
|
||||
|
||||
@ -88,40 +88,40 @@ import java.util.stream.StreamSupport;
|
||||
*
|
||||
* <tr><td valign="top" headers="construct characters"><i>x</i></td>
|
||||
* <td headers="matches">The character <i>x</i></td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\\</tt></td>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \\}</td>
|
||||
* <td headers="matches">The backslash character</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\0</tt><i>n</i></td>
|
||||
* <td headers="matches">The character with octal value <tt>0</tt><i>n</i>
|
||||
* (0 <tt><=</tt> <i>n</i> <tt><=</tt> 7)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\0</tt><i>nn</i></td>
|
||||
* <td headers="matches">The character with octal value <tt>0</tt><i>nn</i>
|
||||
* (0 <tt><=</tt> <i>n</i> <tt><=</tt> 7)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\0</tt><i>mnn</i></td>
|
||||
* <td headers="matches">The character with octal value <tt>0</tt><i>mnn</i>
|
||||
* (0 <tt><=</tt> <i>m</i> <tt><=</tt> 3,
|
||||
* 0 <tt><=</tt> <i>n</i> <tt><=</tt> 7)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\x</tt><i>hh</i></td>
|
||||
* <td headers="matches">The character with hexadecimal value <tt>0x</tt><i>hh</i></td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\u</tt><i>hhhh</i></td>
|
||||
* <td headers="matches">The character with hexadecimal value <tt>0x</tt><i>hhhh</i></td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\x</tt><i>{h...h}</i></td>
|
||||
* <td headers="matches">The character with hexadecimal value <tt>0x</tt><i>h...h</i>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \0}<i>n</i></td>
|
||||
* <td headers="matches">The character with octal value {@code 0}<i>n</i>
|
||||
* (0 {@code <=} <i>n</i> {@code <=} 7)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \0}<i>nn</i></td>
|
||||
* <td headers="matches">The character with octal value {@code 0}<i>nn</i>
|
||||
* (0 {@code <=} <i>n</i> {@code <=} 7)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \0}<i>mnn</i></td>
|
||||
* <td headers="matches">The character with octal value {@code 0}<i>mnn</i>
|
||||
* (0 {@code <=} <i>m</i> {@code <=} 3,
|
||||
* 0 {@code <=} <i>n</i> {@code <=} 7)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \x}<i>hh</i></td>
|
||||
* <td headers="matches">The character with hexadecimal value {@code 0x}<i>hh</i></td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><code>\u</code><i>hhhh</i></td>
|
||||
* <td headers="matches">The character with hexadecimal value {@code 0x}<i>hhhh</i></td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><code>\x</code><i>{h...h}</i></td>
|
||||
* <td headers="matches">The character with hexadecimal value {@code 0x}<i>h...h</i>
|
||||
* ({@link java.lang.Character#MIN_CODE_POINT Character.MIN_CODE_POINT}
|
||||
* <= <tt>0x</tt><i>h...h</i> <=
|
||||
* <= {@code 0x}<i>h...h</i> <=
|
||||
* {@link java.lang.Character#MAX_CODE_POINT Character.MAX_CODE_POINT})</td></tr>
|
||||
* <tr><td valign="top" headers="matches"><tt>\t</tt></td>
|
||||
* <td headers="matches">The tab character (<tt>'\u0009'</tt>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\n</tt></td>
|
||||
* <td headers="matches">The newline (line feed) character (<tt>'\u000A'</tt>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\r</tt></td>
|
||||
* <td headers="matches">The carriage-return character (<tt>'\u000D'</tt>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\f</tt></td>
|
||||
* <td headers="matches">The form-feed character (<tt>'\u000C'</tt>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\a</tt></td>
|
||||
* <td headers="matches">The alert (bell) character (<tt>'\u0007'</tt>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\e</tt></td>
|
||||
* <td headers="matches">The escape character (<tt>'\u001B'</tt>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters"><tt>\c</tt><i>x</i></td>
|
||||
* <tr><td valign="top" headers="matches">{@code \t}</td>
|
||||
* <td headers="matches">The tab character (<code>'\u0009'</code>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \n}</td>
|
||||
* <td headers="matches">The newline (line feed) character (<code>'\u000A'</code>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \r}</td>
|
||||
* <td headers="matches">The carriage-return character (<code>'\u000D'</code>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \f}</td>
|
||||
* <td headers="matches">The form-feed character (<code>'\u000C'</code>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \a}</td>
|
||||
* <td headers="matches">The alert (bell) character (<code>'\u0007'</code>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \e}</td>
|
||||
* <td headers="matches">The escape character (<code>'\u001B'</code>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct characters">{@code \c}<i>x</i></td>
|
||||
* <td headers="matches">The control character corresponding to <i>x</i></td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
@ -149,30 +149,30 @@ import java.util.stream.StreamSupport;
|
||||
*
|
||||
* <tr align="left"><th colspan="2" id="predef">Predefined character classes</th></tr>
|
||||
*
|
||||
* <tr><td valign="top" headers="construct predef"><tt>.</tt></td>
|
||||
* <tr><td valign="top" headers="construct predef">{@code .}</td>
|
||||
* <td headers="matches">Any character (may or may not match <a href="#lt">line terminators</a>)</td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\d</tt></td>
|
||||
* <td headers="matches">A digit: <tt>[0-9]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\D</tt></td>
|
||||
* <td headers="matches">A non-digit: <tt>[^0-9]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\h</tt></td>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \d}</td>
|
||||
* <td headers="matches">A digit: {@code [0-9]}</td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \D}</td>
|
||||
* <td headers="matches">A non-digit: {@code [^0-9]}</td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \h}</td>
|
||||
* <td headers="matches">A horizontal whitespace character:
|
||||
* <tt>[ \t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\H</tt></td>
|
||||
* <td headers="matches">A non-horizontal whitespace character: <tt>[^\h]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\s</tt></td>
|
||||
* <td headers="matches">A whitespace character: <tt>[ \t\n\x0B\f\r]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\S</tt></td>
|
||||
* <td headers="matches">A non-whitespace character: <tt>[^\s]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\v</tt></td>
|
||||
* <td headers="matches">A vertical whitespace character: <tt>[\n\x0B\f\r\x85\u2028\u2029]</tt>
|
||||
* <code>[ \t\xA0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]</code></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \H}</td>
|
||||
* <td headers="matches">A non-horizontal whitespace character: {@code [^\h]}</td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \s}</td>
|
||||
* <td headers="matches">A whitespace character: {@code [ \t\n\x0B\f\r]}</td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \S}</td>
|
||||
* <td headers="matches">A non-whitespace character: {@code [^\s]}</td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \v}</td>
|
||||
* <td headers="matches">A vertical whitespace character: <code>[\n\x0B\f\r\x85\u2028\u2029]</code>
|
||||
* </td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\V</tt></td>
|
||||
* <td headers="matches">A non-vertical whitespace character: <tt>[^\v]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\w</tt></td>
|
||||
* <td headers="matches">A word character: <tt>[a-zA-Z_0-9]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef"><tt>\W</tt></td>
|
||||
* <td headers="matches">A non-word character: <tt>[^\w]</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \V}</td>
|
||||
* <td headers="matches">A non-vertical whitespace character: {@code [^\v]}</td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \w}</td>
|
||||
* <td headers="matches">A word character: {@code [a-zA-Z_0-9]}</td></tr>
|
||||
* <tr><td valign="top" headers="construct predef">{@code \W}</td>
|
||||
* <td headers="matches">A non-word character: {@code [^\w]}</td></tr>
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="posix"><b>POSIX character classes (US-ASCII only)</b></th></tr>
|
||||
*
|
||||
@ -208,13 +208,13 @@ import java.util.stream.StreamSupport;
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2">java.lang.Character classes (simple <a href="#jcc">java character type</a>)</th></tr>
|
||||
*
|
||||
* <tr><td valign="top"><tt>\p{javaLowerCase}</tt></td>
|
||||
* <tr><td valign="top">{@code \p{javaLowerCase}}</td>
|
||||
* <td>Equivalent to java.lang.Character.isLowerCase()</td></tr>
|
||||
* <tr><td valign="top"><tt>\p{javaUpperCase}</tt></td>
|
||||
* <tr><td valign="top">{@code \p{javaUpperCase}}</td>
|
||||
* <td>Equivalent to java.lang.Character.isUpperCase()</td></tr>
|
||||
* <tr><td valign="top"><tt>\p{javaWhitespace}</tt></td>
|
||||
* <tr><td valign="top">{@code \p{javaWhitespace}}</td>
|
||||
* <td>Equivalent to java.lang.Character.isWhitespace()</td></tr>
|
||||
* <tr><td valign="top"><tt>\p{javaMirrored}</tt></td>
|
||||
* <tr><td valign="top">{@code \p{javaMirrored}}</td>
|
||||
* <td>Equivalent to java.lang.Character.isMirrored()</td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
@ -237,77 +237,77 @@ import java.util.stream.StreamSupport;
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="bounds">Boundary matchers</th></tr>
|
||||
*
|
||||
* <tr><td valign="top" headers="construct bounds"><tt>^</tt></td>
|
||||
* <tr><td valign="top" headers="construct bounds">{@code ^}</td>
|
||||
* <td headers="matches">The beginning of a line</td></tr>
|
||||
* <tr><td valign="top" headers="construct bounds"><tt>$</tt></td>
|
||||
* <tr><td valign="top" headers="construct bounds">{@code $}</td>
|
||||
* <td headers="matches">The end of a line</td></tr>
|
||||
* <tr><td valign="top" headers="construct bounds"><tt>\b</tt></td>
|
||||
* <tr><td valign="top" headers="construct bounds">{@code \b}</td>
|
||||
* <td headers="matches">A word boundary</td></tr>
|
||||
* <tr><td valign="top" headers="construct bounds"><tt>\B</tt></td>
|
||||
* <tr><td valign="top" headers="construct bounds">{@code \B}</td>
|
||||
* <td headers="matches">A non-word boundary</td></tr>
|
||||
* <tr><td valign="top" headers="construct bounds"><tt>\A</tt></td>
|
||||
* <tr><td valign="top" headers="construct bounds">{@code \A}</td>
|
||||
* <td headers="matches">The beginning of the input</td></tr>
|
||||
* <tr><td valign="top" headers="construct bounds"><tt>\G</tt></td>
|
||||
* <tr><td valign="top" headers="construct bounds">{@code \G}</td>
|
||||
* <td headers="matches">The end of the previous match</td></tr>
|
||||
* <tr><td valign="top" headers="construct bounds"><tt>\Z</tt></td>
|
||||
* <tr><td valign="top" headers="construct bounds">{@code \Z}</td>
|
||||
* <td headers="matches">The end of the input but for the final
|
||||
* <a href="#lt">terminator</a>, if any</td></tr>
|
||||
* <tr><td valign="top" headers="construct bounds"><tt>\z</tt></td>
|
||||
* <tr><td valign="top" headers="construct bounds">{@code \z}</td>
|
||||
* <td headers="matches">The end of the input</td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="lineending">Linebreak matcher</th></tr>
|
||||
* <tr><td valign="top" headers="construct lineending"><tt>\R</tt></td>
|
||||
* <tr><td valign="top" headers="construct lineending">{@code \R}</td>
|
||||
* <td headers="matches">Any Unicode linebreak sequence, is equivalent to
|
||||
* <tt>\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]
|
||||
* </tt></td></tr>
|
||||
* <code>\u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]
|
||||
* </code></td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="greedy">Greedy quantifiers</th></tr>
|
||||
*
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><tt>?</tt></td>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i>{@code ?}</td>
|
||||
* <td headers="matches"><i>X</i>, once or not at all</td></tr>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><tt>*</tt></td>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i>{@code *}</td>
|
||||
* <td headers="matches"><i>X</i>, zero or more times</td></tr>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><tt>+</tt></td>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i>{@code +}</td>
|
||||
* <td headers="matches"><i>X</i>, one or more times</td></tr>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><tt>{</tt><i>n</i><tt>}</tt></td>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><code>{</code><i>n</i><code>}</code></td>
|
||||
* <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><tt>{</tt><i>n</i><tt>,}</tt></td>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><code>{</code><i>n</i>{@code ,}}</td>
|
||||
* <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><tt>{</tt><i>n</i><tt>,</tt><i>m</i><tt>}</tt></td>
|
||||
* <tr><td valign="top" headers="construct greedy"><i>X</i><code>{</code><i>n</i>{@code ,}<i>m</i><code>}</code></td>
|
||||
* <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="reluc">Reluctant quantifiers</th></tr>
|
||||
*
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><tt>??</tt></td>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i>{@code ??}</td>
|
||||
* <td headers="matches"><i>X</i>, once or not at all</td></tr>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><tt>*?</tt></td>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i>{@code *?}</td>
|
||||
* <td headers="matches"><i>X</i>, zero or more times</td></tr>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><tt>+?</tt></td>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i>{@code +?}</td>
|
||||
* <td headers="matches"><i>X</i>, one or more times</td></tr>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><tt>{</tt><i>n</i><tt>}?</tt></td>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><code>{</code><i>n</i><code>}?</code></td>
|
||||
* <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><tt>{</tt><i>n</i><tt>,}?</tt></td>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><code>{</code><i>n</i><code>,}?</code></td>
|
||||
* <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><tt>{</tt><i>n</i><tt>,</tt><i>m</i><tt>}?</tt></td>
|
||||
* <tr><td valign="top" headers="construct reluc"><i>X</i><code>{</code><i>n</i>{@code ,}<i>m</i><code>}?</code></td>
|
||||
* <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="poss">Possessive quantifiers</th></tr>
|
||||
*
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><tt>?+</tt></td>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i>{@code ?+}</td>
|
||||
* <td headers="matches"><i>X</i>, once or not at all</td></tr>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><tt>*+</tt></td>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i>{@code *+}</td>
|
||||
* <td headers="matches"><i>X</i>, zero or more times</td></tr>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><tt>++</tt></td>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i>{@code ++}</td>
|
||||
* <td headers="matches"><i>X</i>, one or more times</td></tr>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><tt>{</tt><i>n</i><tt>}+</tt></td>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><code>{</code><i>n</i><code>}+</code></td>
|
||||
* <td headers="matches"><i>X</i>, exactly <i>n</i> times</td></tr>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><tt>{</tt><i>n</i><tt>,}+</tt></td>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><code>{</code><i>n</i><code>,}+</code></td>
|
||||
* <td headers="matches"><i>X</i>, at least <i>n</i> times</td></tr>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><tt>{</tt><i>n</i><tt>,</tt><i>m</i><tt>}+</tt></td>
|
||||
* <tr><td valign="top" headers="construct poss"><i>X</i><code>{</code><i>n</i>{@code ,}<i>m</i><code>}+</code></td>
|
||||
* <td headers="matches"><i>X</i>, at least <i>n</i> but not more than <i>m</i> times</td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
@ -315,59 +315,59 @@ import java.util.stream.StreamSupport;
|
||||
*
|
||||
* <tr><td valign="top" headers="construct logical"><i>XY</i></td>
|
||||
* <td headers="matches"><i>X</i> followed by <i>Y</i></td></tr>
|
||||
* <tr><td valign="top" headers="construct logical"><i>X</i><tt>|</tt><i>Y</i></td>
|
||||
* <tr><td valign="top" headers="construct logical"><i>X</i>{@code |}<i>Y</i></td>
|
||||
* <td headers="matches">Either <i>X</i> or <i>Y</i></td></tr>
|
||||
* <tr><td valign="top" headers="construct logical"><tt>(</tt><i>X</i><tt>)</tt></td>
|
||||
* <tr><td valign="top" headers="construct logical">{@code (}<i>X</i>{@code )}</td>
|
||||
* <td headers="matches">X, as a <a href="#cg">capturing group</a></td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="backref">Back references</th></tr>
|
||||
*
|
||||
* <tr><td valign="bottom" headers="construct backref"><tt>\</tt><i>n</i></td>
|
||||
* <tr><td valign="bottom" headers="construct backref">{@code \}<i>n</i></td>
|
||||
* <td valign="bottom" headers="matches">Whatever the <i>n</i><sup>th</sup>
|
||||
* <a href="#cg">capturing group</a> matched</td></tr>
|
||||
*
|
||||
* <tr><td valign="bottom" headers="construct backref"><tt>\</tt><i>k</i><<i>name</i>></td>
|
||||
* <tr><td valign="bottom" headers="construct backref">{@code \}<i>k</i><<i>name</i>></td>
|
||||
* <td valign="bottom" headers="matches">Whatever the
|
||||
* <a href="#groupname">named-capturing group</a> "name" matched</td></tr>
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="quot">Quotation</th></tr>
|
||||
*
|
||||
* <tr><td valign="top" headers="construct quot"><tt>\</tt></td>
|
||||
* <tr><td valign="top" headers="construct quot">{@code \}</td>
|
||||
* <td headers="matches">Nothing, but quotes the following character</td></tr>
|
||||
* <tr><td valign="top" headers="construct quot"><tt>\Q</tt></td>
|
||||
* <td headers="matches">Nothing, but quotes all characters until <tt>\E</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct quot"><tt>\E</tt></td>
|
||||
* <td headers="matches">Nothing, but ends quoting started by <tt>\Q</tt></td></tr>
|
||||
* <tr><td valign="top" headers="construct quot">{@code \Q}</td>
|
||||
* <td headers="matches">Nothing, but quotes all characters until {@code \E}</td></tr>
|
||||
* <tr><td valign="top" headers="construct quot">{@code \E}</td>
|
||||
* <td headers="matches">Nothing, but ends quoting started by {@code \Q}</td></tr>
|
||||
* <!-- Metachars: !$()*+.<>?[\]^{|} -->
|
||||
*
|
||||
* <tr><th> </th></tr>
|
||||
* <tr align="left"><th colspan="2" id="special">Special constructs (named-capturing and non-capturing)</th></tr>
|
||||
*
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?<<a href="#groupname">name</a>></tt><i>X</i><tt>)</tt></td>
|
||||
* <tr><td valign="top" headers="construct special"><code>(?<<a href="#groupname">name</a>></code><i>X</i>{@code )}</td>
|
||||
* <td headers="matches"><i>X</i>, as a named-capturing group</td></tr>
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?:</tt><i>X</i><tt>)</tt></td>
|
||||
* <tr><td valign="top" headers="construct special">{@code (?:}<i>X</i>{@code )}</td>
|
||||
* <td headers="matches"><i>X</i>, as a non-capturing group</td></tr>
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?idmsuxU-idmsuxU) </tt></td>
|
||||
* <tr><td valign="top" headers="construct special"><code>(?idmsuxU-idmsuxU) </code></td>
|
||||
* <td headers="matches">Nothing, but turns match flags <a href="#CASE_INSENSITIVE">i</a>
|
||||
* <a href="#UNIX_LINES">d</a> <a href="#MULTILINE">m</a> <a href="#DOTALL">s</a>
|
||||
* <a href="#UNICODE_CASE">u</a> <a href="#COMMENTS">x</a> <a href="#UNICODE_CHARACTER_CLASS">U</a>
|
||||
* on - off</td></tr>
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?idmsux-idmsux:</tt><i>X</i><tt>)</tt> </td>
|
||||
* <tr><td valign="top" headers="construct special"><code>(?idmsux-idmsux:</code><i>X</i>{@code )} </td>
|
||||
* <td headers="matches"><i>X</i>, as a <a href="#cg">non-capturing group</a> with the
|
||||
* given flags <a href="#CASE_INSENSITIVE">i</a> <a href="#UNIX_LINES">d</a>
|
||||
* <a href="#MULTILINE">m</a> <a href="#DOTALL">s</a> <a href="#UNICODE_CASE">u</a >
|
||||
* <a href="#COMMENTS">x</a> on - off</td></tr>
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?=</tt><i>X</i><tt>)</tt></td>
|
||||
* <tr><td valign="top" headers="construct special">{@code (?=}<i>X</i>{@code )}</td>
|
||||
* <td headers="matches"><i>X</i>, via zero-width positive lookahead</td></tr>
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?!</tt><i>X</i><tt>)</tt></td>
|
||||
* <tr><td valign="top" headers="construct special">{@code (?!}<i>X</i>{@code )}</td>
|
||||
* <td headers="matches"><i>X</i>, via zero-width negative lookahead</td></tr>
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?<=</tt><i>X</i><tt>)</tt></td>
|
||||
* <tr><td valign="top" headers="construct special">{@code (?<=}<i>X</i>{@code )}</td>
|
||||
* <td headers="matches"><i>X</i>, via zero-width positive lookbehind</td></tr>
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?<!</tt><i>X</i><tt>)</tt></td>
|
||||
* <tr><td valign="top" headers="construct special">{@code (?<!}<i>X</i>{@code )}</td>
|
||||
* <td headers="matches"><i>X</i>, via zero-width negative lookbehind</td></tr>
|
||||
* <tr><td valign="top" headers="construct special"><tt>(?></tt><i>X</i><tt>)</tt></td>
|
||||
* <tr><td valign="top" headers="construct special">{@code (?>}<i>X</i>{@code )}</td>
|
||||
* <td headers="matches"><i>X</i>, as an independent, non-capturing group</td></tr>
|
||||
*
|
||||
* </table>
|
||||
@ -377,10 +377,10 @@ import java.util.stream.StreamSupport;
|
||||
*
|
||||
* <h3><a name="bs">Backslashes, escapes, and quoting</a></h3>
|
||||
*
|
||||
* <p> The backslash character (<tt>'\'</tt>) serves to introduce escaped
|
||||
* <p> The backslash character ({@code '\'}) serves to introduce escaped
|
||||
* constructs, as defined in the table above, as well as to quote characters
|
||||
* that otherwise would be interpreted as unescaped constructs. Thus the
|
||||
* expression <tt>\\</tt> matches a single backslash and <tt>\{</tt> matches a
|
||||
* expression {@code \\} matches a single backslash and <code>\{</code> matches a
|
||||
* left brace.
|
||||
*
|
||||
* <p> It is an error to use a backslash prior to any alphabetic character that
|
||||
@ -396,18 +396,18 @@ import java.util.stream.StreamSupport;
|
||||
* It is therefore necessary to double backslashes in string
|
||||
* literals that represent regular expressions to protect them from
|
||||
* interpretation by the Java bytecode compiler. The string literal
|
||||
* <tt>"\b"</tt>, for example, matches a single backspace character when
|
||||
* interpreted as a regular expression, while <tt>"\\b"</tt> matches a
|
||||
* word boundary. The string literal <tt>"\(hello\)"</tt> is illegal
|
||||
* <code>"\b"</code>, for example, matches a single backspace character when
|
||||
* interpreted as a regular expression, while {@code "\\b"} matches a
|
||||
* word boundary. The string literal {@code "\(hello\)"} is illegal
|
||||
* and leads to a compile-time error; in order to match the string
|
||||
* <tt>(hello)</tt> the string literal <tt>"\\(hello\\)"</tt>
|
||||
* {@code (hello)} the string literal {@code "\\(hello\\)"}
|
||||
* must be used.
|
||||
*
|
||||
* <h3><a name="cc">Character Classes</a></h3>
|
||||
*
|
||||
* <p> Character classes may appear within other character classes, and
|
||||
* may be composed by the union operator (implicit) and the intersection
|
||||
* operator (<tt>&&</tt>).
|
||||
* operator ({@code &&}).
|
||||
* The union operator denotes a class that contains every character that is
|
||||
* in at least one of its operand classes. The intersection operator
|
||||
* denotes a class that contains every character that is in both of its
|
||||
@ -420,16 +420,16 @@ import java.util.stream.StreamSupport;
|
||||
* summary="Precedence of character class operators.">
|
||||
* <tr><th>1 </th>
|
||||
* <td>Literal escape </td>
|
||||
* <td><tt>\x</tt></td></tr>
|
||||
* <td>{@code \x}</td></tr>
|
||||
* <tr><th>2 </th>
|
||||
* <td>Grouping</td>
|
||||
* <td><tt>[...]</tt></td></tr>
|
||||
* <td>{@code [...]}</td></tr>
|
||||
* <tr><th>3 </th>
|
||||
* <td>Range</td>
|
||||
* <td><tt>a-z</tt></td></tr>
|
||||
* <td>{@code a-z}</td></tr>
|
||||
* <tr><th>4 </th>
|
||||
* <td>Union</td>
|
||||
* <td><tt>[a-e][i-u]</tt></td></tr>
|
||||
* <td>{@code [a-e][i-u]}</td></tr>
|
||||
* <tr><th>5 </th>
|
||||
* <td>Intersection</td>
|
||||
* <td>{@code [a-z&&[aeiou]]}</td></tr>
|
||||
@ -437,8 +437,8 @@ import java.util.stream.StreamSupport;
|
||||
*
|
||||
* <p> Note that a different set of metacharacters are in effect inside
|
||||
* a character class than outside a character class. For instance, the
|
||||
* regular expression <tt>.</tt> loses its special meaning inside a
|
||||
* character class, while the expression <tt>-</tt> becomes a range
|
||||
* regular expression {@code .} loses its special meaning inside a
|
||||
* character class, while the expression {@code -} becomes a range
|
||||
* forming metacharacter.
|
||||
*
|
||||
* <h3><a name="lt">Line terminators</a></h3>
|
||||
@ -449,49 +449,49 @@ import java.util.stream.StreamSupport;
|
||||
*
|
||||
* <ul>
|
||||
*
|
||||
* <li> A newline (line feed) character (<tt>'\n'</tt>),
|
||||
* <li> A newline (line feed) character ({@code '\n'}),
|
||||
*
|
||||
* <li> A carriage-return character followed immediately by a newline
|
||||
* character (<tt>"\r\n"</tt>),
|
||||
* character ({@code "\r\n"}),
|
||||
*
|
||||
* <li> A standalone carriage-return character (<tt>'\r'</tt>),
|
||||
* <li> A standalone carriage-return character ({@code '\r'}),
|
||||
*
|
||||
* <li> A next-line character (<tt>'\u0085'</tt>),
|
||||
* <li> A next-line character (<code>'\u0085'</code>),
|
||||
*
|
||||
* <li> A line-separator character (<tt>'\u2028'</tt>), or
|
||||
* <li> A line-separator character (<code>'\u2028'</code>), or
|
||||
*
|
||||
* <li> A paragraph-separator character (<tt>'\u2029</tt>).
|
||||
* <li> A paragraph-separator character (<code>'\u2029</code>).
|
||||
*
|
||||
* </ul>
|
||||
* <p>If {@link #UNIX_LINES} mode is activated, then the only line terminators
|
||||
* recognized are newline characters.
|
||||
*
|
||||
* <p> The regular expression <tt>.</tt> matches any character except a line
|
||||
* <p> The regular expression {@code .} matches any character except a line
|
||||
* terminator unless the {@link #DOTALL} flag is specified.
|
||||
*
|
||||
* <p> By default, the regular expressions <tt>^</tt> and <tt>$</tt> ignore
|
||||
* <p> By default, the regular expressions {@code ^} and {@code $} ignore
|
||||
* line terminators and only match at the beginning and the end, respectively,
|
||||
* of the entire input sequence. If {@link #MULTILINE} mode is activated then
|
||||
* <tt>^</tt> matches at the beginning of input and after any line terminator
|
||||
* except at the end of input. When in {@link #MULTILINE} mode <tt>$</tt>
|
||||
* {@code ^} matches at the beginning of input and after any line terminator
|
||||
* except at the end of input. When in {@link #MULTILINE} mode {@code $}
|
||||
* matches just before a line terminator or the end of the input sequence.
|
||||
*
|
||||
* <h3><a name="cg">Groups and capturing</a></h3>
|
||||
*
|
||||
* <h4><a name="gnumber">Group number</a></h4>
|
||||
* <p> Capturing groups are numbered by counting their opening parentheses from
|
||||
* left to right. In the expression <tt>((A)(B(C)))</tt>, for example, there
|
||||
* left to right. In the expression {@code ((A)(B(C)))}, for example, there
|
||||
* are four such groups: </p>
|
||||
*
|
||||
* <blockquote><table cellpadding=1 cellspacing=0 summary="Capturing group numberings">
|
||||
* <tr><th>1 </th>
|
||||
* <td><tt>((A)(B(C)))</tt></td></tr>
|
||||
* <td>{@code ((A)(B(C)))}</td></tr>
|
||||
* <tr><th>2 </th>
|
||||
* <td><tt>(A)</tt></td></tr>
|
||||
* <td>{@code (A)}</td></tr>
|
||||
* <tr><th>3 </th>
|
||||
* <td><tt>(B(C))</tt></td></tr>
|
||||
* <td>{@code (B(C))}</td></tr>
|
||||
* <tr><th>4 </th>
|
||||
* <td><tt>(C)</tt></td></tr>
|
||||
* <td>{@code (C)}</td></tr>
|
||||
* </table></blockquote>
|
||||
*
|
||||
* <p> Group zero always stands for the entire expression.
|
||||
@ -502,31 +502,31 @@ import java.util.stream.StreamSupport;
|
||||
* may also be retrieved from the matcher once the match operation is complete.
|
||||
*
|
||||
* <h4><a name="groupname">Group name</a></h4>
|
||||
* <p>A capturing group can also be assigned a "name", a <tt>named-capturing group</tt>,
|
||||
* <p>A capturing group can also be assigned a "name", a {@code named-capturing group},
|
||||
* and then be back-referenced later by the "name". Group names are composed of
|
||||
* the following characters. The first character must be a <tt>letter</tt>.
|
||||
* the following characters. The first character must be a {@code letter}.
|
||||
*
|
||||
* <ul>
|
||||
* <li> The uppercase letters <tt>'A'</tt> through <tt>'Z'</tt>
|
||||
* (<tt>'\u0041'</tt> through <tt>'\u005a'</tt>),
|
||||
* <li> The lowercase letters <tt>'a'</tt> through <tt>'z'</tt>
|
||||
* (<tt>'\u0061'</tt> through <tt>'\u007a'</tt>),
|
||||
* <li> The digits <tt>'0'</tt> through <tt>'9'</tt>
|
||||
* (<tt>'\u0030'</tt> through <tt>'\u0039'</tt>),
|
||||
* <li> The uppercase letters {@code 'A'} through {@code 'Z'}
|
||||
* (<code>'\u0041'</code> through <code>'\u005a'</code>),
|
||||
* <li> The lowercase letters {@code 'a'} through {@code 'z'}
|
||||
* (<code>'\u0061'</code> through <code>'\u007a'</code>),
|
||||
* <li> The digits {@code '0'} through {@code '9'}
|
||||
* (<code>'\u0030'</code> through <code>'\u0039'</code>),
|
||||
* </ul>
|
||||
*
|
||||
* <p> A <tt>named-capturing group</tt> is still numbered as described in
|
||||
* <p> A {@code named-capturing group} is still numbered as described in
|
||||
* <a href="#gnumber">Group number</a>.
|
||||
*
|
||||
* <p> The captured input associated with a group is always the subsequence
|
||||
* that the group most recently matched. If a group is evaluated a second time
|
||||
* because of quantification then its previously-captured value, if any, will
|
||||
* be retained if the second evaluation fails. Matching the string
|
||||
* <tt>"aba"</tt> against the expression <tt>(a(b)?)+</tt>, for example, leaves
|
||||
* group two set to <tt>"b"</tt>. All captured input is discarded at the
|
||||
* {@code "aba"} against the expression {@code (a(b)?)+}, for example, leaves
|
||||
* group two set to {@code "b"}. All captured input is discarded at the
|
||||
* beginning of each match.
|
||||
*
|
||||
* <p> Groups beginning with <tt>(?</tt> are either pure, <i>non-capturing</i> groups
|
||||
* <p> Groups beginning with {@code (?} are either pure, <i>non-capturing</i> groups
|
||||
* that do not capture text and do not count towards the group total, or
|
||||
* <i>named-capturing</i> group.
|
||||
*
|
||||
@ -537,26 +537,26 @@ import java.util.stream.StreamSupport;
|
||||
* Standard #18: Unicode Regular Expression</i></a>, plus RL2.1
|
||||
* Canonical Equivalents.
|
||||
* <p>
|
||||
* <b>Unicode escape sequences</b> such as <tt>\u2014</tt> in Java source code
|
||||
* <b>Unicode escape sequences</b> such as <code>\u2014</code> in Java source code
|
||||
* are processed as described in section 3.3 of
|
||||
* <cite>The Java™ Language Specification</cite>.
|
||||
* Such escape sequences are also implemented directly by the regular-expression
|
||||
* parser so that Unicode escapes can be used in expressions that are read from
|
||||
* files or from the keyboard. Thus the strings <tt>"\u2014"</tt> and
|
||||
* <tt>"\\u2014"</tt>, while not equal, compile into the same pattern, which
|
||||
* matches the character with hexadecimal value <tt>0x2014</tt>.
|
||||
* files or from the keyboard. Thus the strings <code>"\u2014"</code> and
|
||||
* {@code "\\u2014"}, while not equal, compile into the same pattern, which
|
||||
* matches the character with hexadecimal value {@code 0x2014}.
|
||||
* <p>
|
||||
* A Unicode character can also be represented in a regular-expression by
|
||||
* using its <b>Hex notation</b>(hexadecimal code point value) directly as described in construct
|
||||
* <tt>\x{...}</tt>, for example a supplementary character U+2011F
|
||||
* can be specified as <tt>\x{2011F}</tt>, instead of two consecutive
|
||||
* <code>\x{...}</code>, for example a supplementary character U+2011F
|
||||
* can be specified as <code>\x{2011F}</code>, instead of two consecutive
|
||||
* Unicode escape sequences of the surrogate pair
|
||||
* <tt>\uD840</tt><tt>\uDD1F</tt>.
|
||||
* <code>\uD840</code><code>\uDD1F</code>.
|
||||
* <p>
|
||||
* Unicode scripts, blocks, categories and binary properties are written with
|
||||
* the <tt>\p</tt> and <tt>\P</tt> constructs as in Perl.
|
||||
* <tt>\p{</tt><i>prop</i><tt>}</tt> matches if
|
||||
* the input has the property <i>prop</i>, while <tt>\P{</tt><i>prop</i><tt>}</tt>
|
||||
* the {@code \p} and {@code \P} constructs as in Perl.
|
||||
* <code>\p{</code><i>prop</i><code>}</code> matches if
|
||||
* the input has the property <i>prop</i>, while <code>\P{</code><i>prop</i><code>}</code>
|
||||
* does not match if the input has that property.
|
||||
* <p>
|
||||
* Scripts, blocks, categories and binary properties can be used both inside
|
||||
@ -567,7 +567,7 @@ import java.util.stream.StreamSupport;
|
||||
* {@code IsHiragana}, or by using the {@code script} keyword (or its short
|
||||
* form {@code sc}) as in {@code script=Hiragana} or {@code sc=Hiragana}.
|
||||
* <p>
|
||||
* The script names supported by <code>Pattern</code> are the valid script names
|
||||
* The script names supported by {@code Pattern} are the valid script names
|
||||
* accepted and defined by
|
||||
* {@link java.lang.Character.UnicodeScript#forName(String) UnicodeScript.forName}.
|
||||
*
|
||||
@ -576,7 +576,7 @@ import java.util.stream.StreamSupport;
|
||||
* {@code InMongolian}, or by using the keyword {@code block} (or its short
|
||||
* form {@code blk}) as in {@code block=Mongolian} or {@code blk=Mongolian}.
|
||||
* <p>
|
||||
* The block names supported by <code>Pattern</code> are the valid block names
|
||||
* The block names supported by {@code Pattern} are the valid block names
|
||||
* accepted and defined by
|
||||
* {@link java.lang.Character.UnicodeBlock#forName(String) UnicodeBlock.forName}.
|
||||
* <p>
|
||||
@ -595,7 +595,7 @@ import java.util.stream.StreamSupport;
|
||||
* <p>
|
||||
*
|
||||
* <b><a name="ubpc">Binary properties</a></b> are specified with the prefix {@code Is}, as in
|
||||
* {@code IsAlphabetic}. The supported binary properties by <code>Pattern</code>
|
||||
* {@code IsAlphabetic}. The supported binary properties by {@code Pattern}
|
||||
* are
|
||||
* <ul>
|
||||
* <li> Alphabetic
|
||||
@ -625,88 +625,88 @@ import java.util.stream.StreamSupport;
|
||||
* <th align="left" id="predef_classes">Classes</th>
|
||||
* <th align="left" id="predef_matches">Matches</th>
|
||||
*</tr>
|
||||
* <tr><td><tt>\p{Lower}</tt></td>
|
||||
* <td>A lowercase character:<tt>\p{IsLowercase}</tt></td></tr>
|
||||
* <tr><td><tt>\p{Upper}</tt></td>
|
||||
* <td>An uppercase character:<tt>\p{IsUppercase}</tt></td></tr>
|
||||
* <tr><td><tt>\p{ASCII}</tt></td>
|
||||
* <td>All ASCII:<tt>[\x00-\x7F]</tt></td></tr>
|
||||
* <tr><td><tt>\p{Alpha}</tt></td>
|
||||
* <td>An alphabetic character:<tt>\p{IsAlphabetic}</tt></td></tr>
|
||||
* <tr><td><tt>\p{Digit}</tt></td>
|
||||
* <td>A decimal digit character:<tt>p{IsDigit}</tt></td></tr>
|
||||
* <tr><td><tt>\p{Alnum}</tt></td>
|
||||
* <td>An alphanumeric character:<tt>[\p{IsAlphabetic}\p{IsDigit}]</tt></td></tr>
|
||||
* <tr><td><tt>\p{Punct}</tt></td>
|
||||
* <td>A punctuation character:<tt>p{IsPunctuation}</tt></td></tr>
|
||||
* <tr><td><tt>\p{Graph}</tt></td>
|
||||
* <td>A visible character: <tt>[^\p{IsWhite_Space}\p{gc=Cc}\p{gc=Cs}\p{gc=Cn}]</tt></td></tr>
|
||||
* <tr><td><tt>\p{Print}</tt></td>
|
||||
* <tr><td>{@code \p{Lower}}</td>
|
||||
* <td>A lowercase character:{@code \p{IsLowercase}}</td></tr>
|
||||
* <tr><td>{@code \p{Upper}}</td>
|
||||
* <td>An uppercase character:{@code \p{IsUppercase}}</td></tr>
|
||||
* <tr><td>{@code \p{ASCII}}</td>
|
||||
* <td>All ASCII:{@code [\x00-\x7F]}</td></tr>
|
||||
* <tr><td>{@code \p{Alpha}}</td>
|
||||
* <td>An alphabetic character:{@code \p{IsAlphabetic}}</td></tr>
|
||||
* <tr><td>{@code \p{Digit}}</td>
|
||||
* <td>A decimal digit character:{@code p{IsDigit}}</td></tr>
|
||||
* <tr><td>{@code \p{Alnum}}</td>
|
||||
* <td>An alphanumeric character:{@code [\p{IsAlphabetic}\p{IsDigit}]}</td></tr>
|
||||
* <tr><td>{@code \p{Punct}}</td>
|
||||
* <td>A punctuation character:{@code p{IsPunctuation}}</td></tr>
|
||||
* <tr><td>{@code \p{Graph}}</td>
|
||||
* <td>A visible character: {@code [^\p{IsWhite_Space}\p{gc=Cc}\p{gc=Cs}\p{gc=Cn}]}</td></tr>
|
||||
* <tr><td>{@code \p{Print}}</td>
|
||||
* <td>A printable character: {@code [\p{Graph}\p{Blank}&&[^\p{Cntrl}]]}</td></tr>
|
||||
* <tr><td><tt>\p{Blank}</tt></td>
|
||||
* <tr><td>{@code \p{Blank}}</td>
|
||||
* <td>A space or a tab: {@code [\p{IsWhite_Space}&&[^\p{gc=Zl}\p{gc=Zp}\x0a\x0b\x0c\x0d\x85]]}</td></tr>
|
||||
* <tr><td><tt>\p{Cntrl}</tt></td>
|
||||
* <td>A control character: <tt>\p{gc=Cc}</tt></td></tr>
|
||||
* <tr><td><tt>\p{XDigit}</tt></td>
|
||||
* <td>A hexadecimal digit: <tt>[\p{gc=Nd}\p{IsHex_Digit}]</tt></td></tr>
|
||||
* <tr><td><tt>\p{Space}</tt></td>
|
||||
* <td>A whitespace character:<tt>\p{IsWhite_Space}</tt></td></tr>
|
||||
* <tr><td><tt>\d</tt></td>
|
||||
* <td>A digit: <tt>\p{IsDigit}</tt></td></tr>
|
||||
* <tr><td><tt>\D</tt></td>
|
||||
* <td>A non-digit: <tt>[^\d]</tt></td></tr>
|
||||
* <tr><td><tt>\s</tt></td>
|
||||
* <td>A whitespace character: <tt>\p{IsWhite_Space}</tt></td></tr>
|
||||
* <tr><td><tt>\S</tt></td>
|
||||
* <td>A non-whitespace character: <tt>[^\s]</tt></td></tr>
|
||||
* <tr><td><tt>\w</tt></td>
|
||||
* <td>A word character: <tt>[\p{Alpha}\p{gc=Mn}\p{gc=Me}\p{gc=Mc}\p{Digit}\p{gc=Pc}\p{IsJoin_Control}]</tt></td></tr>
|
||||
* <tr><td><tt>\W</tt></td>
|
||||
* <td>A non-word character: <tt>[^\w]</tt></td></tr>
|
||||
* <tr><td>{@code \p{Cntrl}}</td>
|
||||
* <td>A control character: {@code \p{gc=Cc}}</td></tr>
|
||||
* <tr><td>{@code \p{XDigit}}</td>
|
||||
* <td>A hexadecimal digit: {@code [\p{gc=Nd}\p{IsHex_Digit}]}</td></tr>
|
||||
* <tr><td>{@code \p{Space}}</td>
|
||||
* <td>A whitespace character:{@code \p{IsWhite_Space}}</td></tr>
|
||||
* <tr><td>{@code \d}</td>
|
||||
* <td>A digit: {@code \p{IsDigit}}</td></tr>
|
||||
* <tr><td>{@code \D}</td>
|
||||
* <td>A non-digit: {@code [^\d]}</td></tr>
|
||||
* <tr><td>{@code \s}</td>
|
||||
* <td>A whitespace character: {@code \p{IsWhite_Space}}</td></tr>
|
||||
* <tr><td>{@code \S}</td>
|
||||
* <td>A non-whitespace character: {@code [^\s]}</td></tr>
|
||||
* <tr><td>{@code \w}</td>
|
||||
* <td>A word character: {@code [\p{Alpha}\p{gc=Mn}\p{gc=Me}\p{gc=Mc}\p{Digit}\p{gc=Pc}\p{IsJoin_Control}]}</td></tr>
|
||||
* <tr><td>{@code \W}</td>
|
||||
* <td>A non-word character: {@code [^\w]}</td></tr>
|
||||
* </table>
|
||||
* <p>
|
||||
* <a name="jcc">
|
||||
* Categories that behave like the java.lang.Character
|
||||
* boolean is<i>methodname</i> methods (except for the deprecated ones) are
|
||||
* available through the same <tt>\p{</tt><i>prop</i><tt>}</tt> syntax where
|
||||
* the specified property has the name <tt>java<i>methodname</i></tt></a>.
|
||||
* available through the same <code>\p{</code><i>prop</i><code>}</code> syntax where
|
||||
* the specified property has the name <code>java<i>methodname</i></code></a>.
|
||||
*
|
||||
* <h3> Comparison to Perl 5 </h3>
|
||||
*
|
||||
* <p>The <code>Pattern</code> engine performs traditional NFA-based matching
|
||||
* <p>The {@code Pattern} engine performs traditional NFA-based matching
|
||||
* with ordered alternation as occurs in Perl 5.
|
||||
*
|
||||
* <p> Perl constructs not supported by this class: </p>
|
||||
*
|
||||
* <ul>
|
||||
* <li><p> Predefined character classes (Unicode character)
|
||||
* <p><tt>\X </tt>Match Unicode
|
||||
* <p><code>\X </code>Match Unicode
|
||||
* <a href="http://www.unicode.org/reports/tr18/#Default_Grapheme_Clusters">
|
||||
* <i>extended grapheme cluster</i></a>
|
||||
* </p></li>
|
||||
*
|
||||
* <li><p> The backreference constructs, <tt>\g{</tt><i>n</i><tt>}</tt> for
|
||||
* <li><p> The backreference constructs, <code>\g{</code><i>n</i><code>}</code> for
|
||||
* the <i>n</i><sup>th</sup><a href="#cg">capturing group</a> and
|
||||
* <tt>\g{</tt><i>name</i><tt>}</tt> for
|
||||
* <code>\g{</code><i>name</i><code>}</code> for
|
||||
* <a href="#groupname">named-capturing group</a>.
|
||||
* </p></li>
|
||||
*
|
||||
* <li><p> The named character construct, <tt>\N{</tt><i>name</i><tt>}</tt>
|
||||
* <li><p> The named character construct, <code>\N{</code><i>name</i><code>}</code>
|
||||
* for a Unicode character by its name.
|
||||
* </p></li>
|
||||
*
|
||||
* <li><p> The conditional constructs
|
||||
* <tt>(?(</tt><i>condition</i><tt>)</tt><i>X</i><tt>)</tt> and
|
||||
* <tt>(?(</tt><i>condition</i><tt>)</tt><i>X</i><tt>|</tt><i>Y</i><tt>)</tt>,
|
||||
* {@code (?(}<i>condition</i>{@code )}<i>X</i>{@code )} and
|
||||
* {@code (?(}<i>condition</i>{@code )}<i>X</i>{@code |}<i>Y</i>{@code )},
|
||||
* </p></li>
|
||||
*
|
||||
* <li><p> The embedded code constructs <tt>(?{</tt><i>code</i><tt>})</tt>
|
||||
* and <tt>(??{</tt><i>code</i><tt>})</tt>,</p></li>
|
||||
* <li><p> The embedded code constructs <code>(?{</code><i>code</i><code>})</code>
|
||||
* and <code>(??{</code><i>code</i><code>})</code>,</p></li>
|
||||
*
|
||||
* <li><p> The embedded comment syntax <tt>(?#comment)</tt>, and </p></li>
|
||||
* <li><p> The embedded comment syntax {@code (?#comment)}, and </p></li>
|
||||
*
|
||||
* <li><p> The preprocessing operations <tt>\l</tt> <tt>\u</tt>,
|
||||
* <tt>\L</tt>, and <tt>\U</tt>. </p></li>
|
||||
* <li><p> The preprocessing operations {@code \l} <code>\u</code>,
|
||||
* {@code \L}, and {@code \U}. </p></li>
|
||||
*
|
||||
* </ul>
|
||||
*
|
||||
@ -723,19 +723,19 @@ import java.util.stream.StreamSupport;
|
||||
*
|
||||
* <ul>
|
||||
*
|
||||
* <li><p> In Perl, <tt>\1</tt> through <tt>\9</tt> are always interpreted
|
||||
* as back references; a backslash-escaped number greater than <tt>9</tt> is
|
||||
* <li><p> In Perl, {@code \1} through {@code \9} are always interpreted
|
||||
* as back references; a backslash-escaped number greater than {@code 9} is
|
||||
* treated as a back reference if at least that many subexpressions exist,
|
||||
* otherwise it is interpreted, if possible, as an octal escape. In this
|
||||
* class octal escapes must always begin with a zero. In this class,
|
||||
* <tt>\1</tt> through <tt>\9</tt> are always interpreted as back
|
||||
* {@code \1} through {@code \9} are always interpreted as back
|
||||
* references, and a larger number is accepted as a back reference if at
|
||||
* least that many subexpressions exist at that point in the regular
|
||||
* expression, otherwise the parser will drop digits until the number is
|
||||
* smaller or equal to the existing number of groups or it is one digit.
|
||||
* </p></li>
|
||||
*
|
||||
* <li><p> Perl uses the <tt>g</tt> flag to request a match that resumes
|
||||
* <li><p> Perl uses the {@code g} flag to request a match that resumes
|
||||
* where the last match left off. This functionality is provided implicitly
|
||||
* by the {@link Matcher} class: Repeated invocations of the {@link
|
||||
* Matcher#find find} method will resume where the last match left off,
|
||||
@ -786,11 +786,11 @@ public final class Pattern
|
||||
/**
|
||||
* Enables Unix lines mode.
|
||||
*
|
||||
* <p> In this mode, only the <tt>'\n'</tt> line terminator is recognized
|
||||
* in the behavior of <tt>.</tt>, <tt>^</tt>, and <tt>$</tt>.
|
||||
* <p> In this mode, only the {@code '\n'} line terminator is recognized
|
||||
* in the behavior of {@code .}, {@code ^}, and {@code $}.
|
||||
*
|
||||
* <p> Unix lines mode can also be enabled via the embedded flag
|
||||
* expression <tt>(?d)</tt>.
|
||||
* expression {@code (?d)}.
|
||||
*/
|
||||
public static final int UNIX_LINES = 0x01;
|
||||
|
||||
@ -803,7 +803,7 @@ public final class Pattern
|
||||
* #UNICODE_CASE} flag in conjunction with this flag.
|
||||
*
|
||||
* <p> Case-insensitive matching can also be enabled via the embedded flag
|
||||
* expression <tt>(?i)</tt>.
|
||||
* expression {@code (?i)}.
|
||||
*
|
||||
* <p> Specifying this flag may impose a slight performance penalty. </p>
|
||||
*/
|
||||
@ -813,23 +813,23 @@ public final class Pattern
|
||||
* Permits whitespace and comments in pattern.
|
||||
*
|
||||
* <p> In this mode, whitespace is ignored, and embedded comments starting
|
||||
* with <tt>#</tt> are ignored until the end of a line.
|
||||
* with {@code #} are ignored until the end of a line.
|
||||
*
|
||||
* <p> Comments mode can also be enabled via the embedded flag
|
||||
* expression <tt>(?x)</tt>.
|
||||
* expression {@code (?x)}.
|
||||
*/
|
||||
public static final int COMMENTS = 0x04;
|
||||
|
||||
/**
|
||||
* Enables multiline mode.
|
||||
*
|
||||
* <p> In multiline mode the expressions <tt>^</tt> and <tt>$</tt> match
|
||||
* <p> In multiline mode the expressions {@code ^} and {@code $} match
|
||||
* just after or just before, respectively, a line terminator or the end of
|
||||
* the input sequence. By default these expressions only match at the
|
||||
* beginning and the end of the entire input sequence.
|
||||
*
|
||||
* <p> Multiline mode can also be enabled via the embedded flag
|
||||
* expression <tt>(?m)</tt>. </p>
|
||||
* expression {@code (?m)}. </p>
|
||||
*/
|
||||
public static final int MULTILINE = 0x08;
|
||||
|
||||
@ -853,12 +853,12 @@ public final class Pattern
|
||||
/**
|
||||
* Enables dotall mode.
|
||||
*
|
||||
* <p> In dotall mode, the expression <tt>.</tt> matches any character,
|
||||
* <p> In dotall mode, the expression {@code .} matches any character,
|
||||
* including a line terminator. By default this expression does not match
|
||||
* line terminators.
|
||||
*
|
||||
* <p> Dotall mode can also be enabled via the embedded flag
|
||||
* expression <tt>(?s)</tt>. (The <tt>s</tt> is a mnemonic for
|
||||
* expression {@code (?s)}. (The {@code s} is a mnemonic for
|
||||
* "single-line" mode, which is what this is called in Perl.) </p>
|
||||
*/
|
||||
public static final int DOTALL = 0x20;
|
||||
@ -873,7 +873,7 @@ public final class Pattern
|
||||
* matched.
|
||||
*
|
||||
* <p> Unicode-aware case folding can also be enabled via the embedded flag
|
||||
* expression <tt>(?u)</tt>.
|
||||
* expression {@code (?u)}.
|
||||
*
|
||||
* <p> Specifying this flag may impose a performance penalty. </p>
|
||||
*/
|
||||
@ -884,8 +884,8 @@ public final class Pattern
|
||||
*
|
||||
* <p> When this flag is specified then two characters will be considered
|
||||
* to match if, and only if, their full canonical decompositions match.
|
||||
* The expression <tt>"a\u030A"</tt>, for example, will match the
|
||||
* string <tt>"\u00E5"</tt> when this flag is specified. By default,
|
||||
* The expression <code>"a\u030A"</code>, for example, will match the
|
||||
* string <code>"\u00E5"</code> when this flag is specified. By default,
|
||||
* matching does not take canonical equivalence into account.
|
||||
*
|
||||
* <p> There is no embedded flag character for enabling canonical
|
||||
@ -907,7 +907,7 @@ public final class Pattern
|
||||
* <i>Annex C: Compatibility Properties</i>.
|
||||
* <p>
|
||||
* The UNICODE_CHARACTER_CLASS mode can also be enabled via the embedded
|
||||
* flag expression <tt>(?U)</tt>.
|
||||
* flag expression {@code (?U)}.
|
||||
* <p>
|
||||
* The flag implies UNICODE_CASE, that is, it enables Unicode-aware case
|
||||
* folding.
|
||||
@ -1052,7 +1052,7 @@ public final class Pattern
|
||||
* @return the given regular expression compiled into a pattern with the given flags
|
||||
* @throws IllegalArgumentException
|
||||
* If bit values other than those corresponding to the defined
|
||||
* match flags are set in <tt>flags</tt>
|
||||
* match flags are set in {@code flags}
|
||||
*
|
||||
* @throws PatternSyntaxException
|
||||
* If the expression's syntax is invalid
|
||||
@ -1158,7 +1158,7 @@ public final class Pattern
|
||||
* of the resulting array. A zero-width match at the beginning however
|
||||
* never produces such empty leading substring.
|
||||
*
|
||||
* <p> The <tt>limit</tt> parameter controls the number of times the
|
||||
* <p> The {@code limit} parameter controls the number of times the
|
||||
* pattern is applied and therefore affects the length of the resulting
|
||||
* array. If the limit <i>n</i> is greater than zero then the pattern
|
||||
* will be applied at most <i>n</i> - 1 times, the array's
|
||||
@ -1169,7 +1169,7 @@ public final class Pattern
|
||||
* the pattern will be applied as many times as possible, the array can
|
||||
* have any length, and trailing empty strings will be discarded.
|
||||
*
|
||||
* <p> The input <tt>"boo:and:foo"</tt>, for example, yields the following
|
||||
* <p> The input {@code "boo:and:foo"}, for example, yields the following
|
||||
* results with these parameters:
|
||||
*
|
||||
* <blockquote><table cellpadding=1 cellspacing=0
|
||||
@ -1179,22 +1179,22 @@ public final class Pattern
|
||||
* <th align="left"><i>Result </i></th></tr>
|
||||
* <tr><td align=center>:</td>
|
||||
* <td align=center>2</td>
|
||||
* <td><tt>{ "boo", "and:foo" }</tt></td></tr>
|
||||
* <td>{@code { "boo", "and:foo" }}</td></tr>
|
||||
* <tr><td align=center>:</td>
|
||||
* <td align=center>5</td>
|
||||
* <td><tt>{ "boo", "and", "foo" }</tt></td></tr>
|
||||
* <td>{@code { "boo", "and", "foo" }}</td></tr>
|
||||
* <tr><td align=center>:</td>
|
||||
* <td align=center>-2</td>
|
||||
* <td><tt>{ "boo", "and", "foo" }</tt></td></tr>
|
||||
* <td>{@code { "boo", "and", "foo" }}</td></tr>
|
||||
* <tr><td align=center>o</td>
|
||||
* <td align=center>5</td>
|
||||
* <td><tt>{ "b", "", ":and:f", "", "" }</tt></td></tr>
|
||||
* <td>{@code { "b", "", ":and:f", "", "" }}</td></tr>
|
||||
* <tr><td align=center>o</td>
|
||||
* <td align=center>-2</td>
|
||||
* <td><tt>{ "b", "", ":and:f", "", "" }</tt></td></tr>
|
||||
* <td>{@code { "b", "", ":and:f", "", "" }}</td></tr>
|
||||
* <tr><td align=center>o</td>
|
||||
* <td align=center>0</td>
|
||||
* <td><tt>{ "b", "", ":and:f" }</tt></td></tr>
|
||||
* <td>{@code { "b", "", ":and:f" }}</td></tr>
|
||||
* </table></blockquote>
|
||||
*
|
||||
* @param input
|
||||
@ -1256,7 +1256,7 @@ public final class Pattern
|
||||
* sequence and a limit argument of zero. Trailing empty strings are
|
||||
* therefore not included in the resulting array. </p>
|
||||
*
|
||||
* <p> The input <tt>"boo:and:foo"</tt>, for example, yields the following
|
||||
* <p> The input {@code "boo:and:foo"}, for example, yields the following
|
||||
* results with these expressions:
|
||||
*
|
||||
* <blockquote><table cellpadding=1 cellspacing=0
|
||||
@ -1264,9 +1264,9 @@ public final class Pattern
|
||||
* <tr><th align="left"><i>Regex </i></th>
|
||||
* <th align="left"><i>Result</i></th></tr>
|
||||
* <tr><td align=center>:</td>
|
||||
* <td><tt>{ "boo", "and", "foo" }</tt></td></tr>
|
||||
* <td>{@code { "boo", "and", "foo" }}</td></tr>
|
||||
* <tr><td align=center>o</td>
|
||||
* <td><tt>{ "b", "", ":and:f" }</tt></td></tr>
|
||||
* <td>{@code { "b", "", ":and:f" }}</td></tr>
|
||||
* </table></blockquote>
|
||||
*
|
||||
*
|
||||
@ -1281,12 +1281,12 @@ public final class Pattern
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a literal pattern <code>String</code> for the specified
|
||||
* <code>String</code>.
|
||||
* Returns a literal pattern {@code String} for the specified
|
||||
* {@code String}.
|
||||
*
|
||||
* <p>This method produces a <code>String</code> that can be used to
|
||||
* create a <code>Pattern</code> that would match the string
|
||||
* <code>s</code> as if it were a literal pattern.</p> Metacharacters
|
||||
* <p>This method produces a {@code String} that can be used to
|
||||
* create a {@code Pattern} that would match the string
|
||||
* {@code s} as if it were a literal pattern.</p> Metacharacters
|
||||
* or escape sequences in the input sequence will be given no special
|
||||
* meaning.
|
||||
*
|
||||
|
||||
@ -57,7 +57,7 @@ public class PatternSyntaxException
|
||||
*
|
||||
* @param index
|
||||
* The approximate index in the pattern of the error,
|
||||
* or <tt>-1</tt> if the index is not known
|
||||
* or {@code -1} if the index is not known
|
||||
*/
|
||||
public PatternSyntaxException(String desc, String regex, int index) {
|
||||
this.desc = desc;
|
||||
@ -69,7 +69,7 @@ public class PatternSyntaxException
|
||||
* Retrieves the error index.
|
||||
*
|
||||
* @return The approximate index in the pattern of the error,
|
||||
* or <tt>-1</tt> if the index is not known
|
||||
* or {@code -1} if the index is not known
|
||||
*/
|
||||
public int getIndex() {
|
||||
return index;
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
* interface in order to support matching against characters from a
|
||||
* wide variety of input sources. </p>
|
||||
*
|
||||
* <p> Unless otherwise noted, passing a <tt>null</tt> argument to a
|
||||
* <p> Unless otherwise noted, passing a <code>null</code> argument to a
|
||||
* method in any class or interface in this package will cause a
|
||||
* {@link java.lang.NullPointerException NullPointerException} to be
|
||||
* thrown.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user