| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Creates and returns a copy of this
Object. |
int |
current() |
boolean |
equals(Object object)
Compares this instance with the specified object and indicates if they
are equal.
|
protected void |
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
int |
first() |
int |
following(int offset) |
static NativeBreakIterator |
getCharacterInstance(Locale locale) |
static NativeBreakIterator |
getLineInstance(Locale locale) |
static NativeBreakIterator |
getSentenceInstance(Locale locale) |
CharacterIterator |
getText() |
static NativeBreakIterator |
getWordInstance(Locale locale) |
int |
hashCode()
Returns an integer hash code for this object.
|
boolean |
hasText() |
boolean |
isBoundary(int offset) |
int |
last() |
int |
next() |
int |
next(int n) |
int |
preceding(int offset) |
int |
previous() |
void |
setText(CharacterIterator newText) |
void |
setText(String newText) |
public Object clone()
ObjectObject. The default
implementation returns a so-called "shallow" copy: It creates a new
instance of the same class and then copies the field values (including
object references) from this instance to the new instance. A "deep" copy,
in contrast, would also recursively clone nested objects. A subclass that
needs to implement this kind of cloning should call super.clone()
to create the new instance and then create deep copies of the nested,
mutable objects.public boolean equals(Object object)
Objecto must represent the same object
as this instance using a class-specific comparison. The general contract
is that this comparison should be reflexive, symmetric, and transitive.
Also, no object reference other than null is equal to null.
The default implementation returns true only if this ==
o. See Writing a correct
equals method
if you intend implementing your own equals method.
The general contract for the equals and Object.hashCode() methods is that if equals returns true for
any two objects, then hashCode() must return the same value for
these objects. This means that subclasses of Object usually
override either both methods or neither of them.
equals in class Objectobject - the object to compare this instance with.true if the specified object is equal to this Object; false otherwise.Object.hashCode()public int hashCode()
ObjectObject.equals(java.lang.Object) returns true must return
the same hash code value. This means that subclasses of Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See Writing a correct
hashCode method
if you intend implementing your own hashCode method.
hashCode in class ObjectObject.equals(java.lang.Object)protected void finalize()
throws Throwable
ObjectNote that objects that override finalize are significantly more expensive than
objects that don't. Finalizers may be run a long time after the object is no longer
reachable, depending on memory pressure, so it's a bad idea to rely on them for cleanup.
Note also that finalizers are run on a single VM-wide finalizer thread,
so doing blocking work in a finalizer is a bad idea. A finalizer is usually only necessary
for a class that has a native peer and needs to call a native method to destroy that peer.
Even then, it's better to provide an explicit close method (and implement
Closeable), and insist that callers manually dispose of instances. This
works well for something like files, but less well for something like a BigInteger
where typical calling code would have to deal with lots of temporaries. Unfortunately,
code that creates lots of temporaries is the worst kind of code from the point of view of
the single finalizer thread.
If you must use finalizers, consider at least providing your own
ReferenceQueue and having your own thread process that queue.
Unlike constructors, finalizers are not automatically chained. You are responsible for
calling super.finalize() yourself.
Uncaught exceptions thrown by finalizers are ignored and do not terminate the finalizer thread. See Effective Java Item 7, "Avoid finalizers" for more.
public int current()
public int first()
public int following(int offset)
public CharacterIterator getText()
public int last()
public int next(int n)
public int next()
public int previous()
public void setText(CharacterIterator newText)
public void setText(String newText)
public boolean hasText()
public boolean isBoundary(int offset)
public int preceding(int offset)
public static NativeBreakIterator getCharacterInstance(Locale locale)
public static NativeBreakIterator getLineInstance(Locale locale)
public static NativeBreakIterator getSentenceInstance(Locale locale)
public static NativeBreakIterator getWordInstance(Locale locale)