Suppose we have a string holding the text of an entire book. If we want to analyze
Question:
Suppose we have a string holding the text of an entire book. If we want to analyze segments of the text, it is inefficient to make substrings. Instead, we should just store a reference to the original text and the starting and ending positions. Design a class Segment that does this, and have it implement the CharSequence interface of the standard library. Write a test program in which you demonstrate that you can pass your Segment objects to methods that accept CharSequence instances, such as String.join and PrintStream.append.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: