Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7821823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:45:48+00:00 2026-06-02T07:45:48+00:00

I have a linked list question that stems from this homework prompt I am

  • 0

I have a linked list question that stems from this homework prompt I am about to post. it might help with the answer:

Specifics

The Java String class is immutable (you cannot change the contents). This is sometimes a hindrance to what you want to do with a string (i.e. make changes to the existing string). So, for this assignment you will create a class called MutableString. NOTE/DISCLAIMER: The Java API does have a class StringBuffer, which is mutable, but for the intents and purposes of this assignment we’ll pretend we don’t know about it 😉

An object of the MutableString class contains the following operations/behaviors -- which means the class itself must contain the following methods:

Character charAt(int index): returns the Character at the specified index in the string -- if the index lies outside the string, throw a MutableStringIndexOutOfBoundsException (you must write this class)

void set(int index, Character ch): replaces the existing Character at the specified location -- if the index lies outside the string throw a MutableStringIndexOutOfBoundsException

void add(int index, Character ch): creates a new spot in the list for the Character at the index specified -- if the index lies outside the string throw a MutableStringIndexOutOfBoundsException

Character remove(int index): removes the Character at specified index -- if the index lies outside the string, throw a MutableStringIndexOutOfBoundsException

boolean remove(Character ch): removes the first occurrence (starting from the beginning of the MutableString) of the Character -- if the Character is not found, return false

boolean removeAll(Character ch): removes all occurrences of the specified Character -- if Character is not found, return false

void toUpper(): converts the current string to all upper case

void toLower(): converts the current string to all lower case

MutableString substring(int start, int finish): returns a string starting at the Character specified by start and concluding with the Character specified by finish -- if start or finish is outside the the string, throw a MutableStringIndexOutOfBoundsException

char [] toCharArray(): returns a char array containing all the characters in the string -- be sure and handle all cases

int length(): reports/returns the length of the string

String toString(): returns a String containing all the Characters

String toReverseString(): returns a String containing all the Characters in reverse order -- you must utilize recursion to accomplish this task

int compareTo(MutableString that): allows comparison of two MutableString objects -- this implies you will implement the Comparable interface for your MutableString class

void sort(): alphabetizes the letters in case-insensitive fashion in ascending order -- you must write the code for this sort (no API calls are allowed)

You must use a linked list to represent the characters of the string (you must write the
LinkeList class). Your LinkedList class should contain fundamental operations for updating and modifying the list. With this in mind, implement the List interface in the Java API. For methods that you deem unnecessary for your LinkedList’s functionality, stub those methods out and throw an Exception that contains information about what method was called and that it has not been implemented. NOTE: Make sure your LinkedList class does not do anything MutableString specific. Feel free to use the following stubbed out LinkedList class for your assignment. It may not contain all the methods you will need, but it does contain the methods from the List interface from the Java API.

MutableString must utilize the LinkedList behaviors (methods) wherever possible (don’t write code in MutableString that does the same thing as something in the LinkedList class). Thus your MutableString will contain a field that is a reference to a LinkedList object. BTW, this concept is known as delegation, a very important idea in software engineering and design. Do NOT design MutableString so that it inherits from LinkedList.

Each Node of your MutableString should contain a Character — note that this does not mean the reference to the data in your node class should/must be type Character — that would make your LinkedList class specific to MutableString, and we don’t want that in this case.

**the part I dont understand is the paragraph 2 above that talks about inheriting from the linked list class. I was always used to writing something like public class MutableString extends LinkedList but we cant do that and I dont really know how to start writing this mutablestring class without inheriting from the class. Help on explaining how to do it and the difference would be awesome. thanks.

Im not very good at linked lists so bare with this question 🙂
**

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:45:49+00:00Added an answer on June 2, 2026 at 7:45 am

    It says that you should use delegation instead of inheritance.

    For difference between delegation and inheritance, check this out. It explains with an example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a question about circularly linked lists. My linked list object has two
I have a linked list that I want to sort part of, eg: std::sort(someIterator,
I have created two classes, class A that uses a Linked List and class
I have a class that implements a linked list. The class has a find()
I am learning linked list operations and have a question related to parameter passing.
This is an assignment question that I am having trouble wording an answer to.
I have a linked list, which stores groups of settings for my application: typedef
Say you have a linked list structure in Java. It's made up of Nodes:
I have implemented a linked list as a self-referencing database table: CREATE TABLE LinkedList(
I have a vector of Linked list pointers. Each LinkedList has a head pointer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.