public class FlaggableString extends Object implements CharSequence, Comparable<FlaggableString>, Cloneable, Serializable
Constructor and Description |
---|
FlaggableString(CharSequence value)
Creates a new un-flagged instance of FlaggableString.
|
FlaggableString(CharSequence value,
boolean flag)
Creates a new instance of FlaggableString with the specified flag.
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index) |
Object |
clone() |
int |
compareTo(FlaggableString fs2)
Defines a sort order where any non-flagged strings are sorted alphabetically
first, followed by any flagged strings sorted in a second alphabetical
sequence.
|
boolean |
equals(Object o) |
static List<String> |
getOnlyState(List<FlaggableString> list,
boolean flagged)
Extracts only those
FlaggableString s from a list of FlaggableString s
which are in the specified flag state. |
int |
hashCode() |
boolean |
isFlagged()
Determines whether the string is flagged.
|
int |
length() |
void |
setFlagged(boolean state)
Sets the flag state of the string.
|
CharSequence |
subSequence(int start,
int end) |
String |
toString() |
finalize, getClass, notify, notifyAll, wait, wait, wait
chars, codePoints
public FlaggableString(CharSequence value)
value
- The text the FlaggableString should contain.public FlaggableString(CharSequence value, boolean flag)
value
- The text the FlaggableString should contain.flag
- The value to give the flagpublic void setFlagged(boolean state)
state
- true
to set the flagpublic boolean isFlagged()
true
if the flag is setpublic int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public int compareTo(FlaggableString fs2)
compareTo
in interface Comparable<FlaggableString>
fs2
- the FlaggableString
to be comparedpublic String toString()
toString
in interface CharSequence
toString
in class Object
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public static List<String> getOnlyState(List<FlaggableString> list, boolean flagged)
FlaggableString
s from a list of FlaggableString
s
which are in the specified flag state. The returned list is always a new object.list
- a list of FlaggableString
s, or null
flagged
- true
to extract flagged, false
to extract unflaggedString
s, which may be zero-length but will never be null
Copyright © 2018. All rights reserved.