Class NativeBreakIterator
- All Implemented Interfaces:
Cloneable
public final class NativeBreakIterator extends Object implements Cloneable
-
Method Summary
Modifier and Type Method Description Objectclone()Creates and returns a copy of thisObject.intcurrent()booleanequals(Object object)Compares this instance with the specified object and indicates if they are equal.protected voidfinalize()Invoked when the garbage collector has detected that this instance is no longer reachable.intfirst()intfollowing(int offset)static NativeBreakIteratorgetCharacterInstance(Locale where)static NativeBreakIteratorgetLineInstance(Locale where)static NativeBreakIteratorgetSentenceInstance(Locale where)CharacterIteratorgetText()static NativeBreakIteratorgetWordInstance(Locale where)inthashCode()Returns an integer hash code for this object.booleanhasText()booleanisBoundary(int offset)intlast()intnext()intnext(int n)intpreceding(int offset)intprevious()voidsetText(String newText)voidsetText(CharacterIterator newText)
-
Method Details
-
clone
Description copied from class:ObjectCreates and returns a copy of thisObject. 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 callsuper.clone()to create the new instance and then create deep copies of the nested, mutable objects. -
equals
Description copied from class:ObjectCompares this instance with the specified object and indicates if they are equal. In order to be equal,omust 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
trueonly ifthis == o. See Writing a correctequalsmethod if you intend implementing your ownequalsmethod.The general contract for the
equalsandObject.hashCode()methods is that ifequalsreturnstruefor any two objects, thenhashCode()must return the same value for these objects. This means that subclasses ofObjectusually override either both methods or neither of them.- Overrides:
equalsin classObject- Parameters:
object- the object to compare this instance with.- Returns:
trueif the specified object is equal to thisObject;falseotherwise.- See Also:
Object.hashCode()
-
hashCode
public int hashCode()Description copied from class:ObjectReturns an integer hash code for this object. By contract, any two objects for whichObject.equals(java.lang.Object)returnstruemust return the same hash code value. This means that subclasses ofObjectusually 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
hashCodemethod if you intend implementing your ownhashCodemethod.- Overrides:
hashCodein classObject- Returns:
- this object's hash code.
- See Also:
Object.equals(java.lang.Object)
-
finalize
Description copied from class:ObjectInvoked when the garbage collector has detected that this instance is no longer reachable. The default implementation does nothing, but this method can be overridden to free resources.Note that objects that override
finalizeare 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 explicitclosemethod (and implementCloseable), and insist that callers manually dispose of instances. This works well for something like files, but less well for something like aBigIntegerwhere 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
ReferenceQueueand 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.
-
current
public int current() -
first
public int first() -
following
public int following(int offset) -
getText
-
last
public int last() -
next
public int next(int n) -
next
public int next() -
previous
public int previous() -
setText
-
setText
-
hasText
public boolean hasText() -
isBoundary
public boolean isBoundary(int offset) -
preceding
public int preceding(int offset) -
getCharacterInstance
-
getLineInstance
-
getSentenceInstance
-
getWordInstance
-