Package org.cactoos.text
Class ComparableText
- java.lang.Object
-
- org.cactoos.text.TextEnvelope
-
- org.cactoos.text.ComparableText
-
- All Implemented Interfaces:
Comparable<Text>
,Text
public final class ComparableText extends TextEnvelope implements Comparable<Text>
Text implementing Comparable.
Below the example how you can sort words in a string:Iterable<Text> sorted = new Sorted<>( new Mapped<>( ComparableText::new, new SplitText("The quick brown fox jumps over the lazy dog", " ") ) )
There is no thread-safety guarantee.
- Since:
- 0.27
-
-
Constructor Summary
Constructors Constructor Description ComparableText(Text text)
Ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Text other)
-
Methods inherited from class org.cactoos.text.TextEnvelope
asString, equals, hashCode, toString
-
-
-
-
Constructor Detail
-
ComparableText
public ComparableText(Text text)
Ctor.- Parameters:
text
- The text
-
-
Method Detail
-
compareTo
public int compareTo(Text other)
- Specified by:
compareTo
in interfaceComparable<Text>
-
-