Class SortedLinkedList
java.lang.Object
SortedLinkedList
Represents a sorted linked list of integers.
The list is created from a comma-separated string of integers.
How to Run: javac -d bin *.java java -cp bin SortedLinkedList.java
Command Used to create Javadocs: javadoc -d docs *.java
-
Constructor Summary
ConstructorsConstructorDescriptionSortedLinkedList
(String integerString) Constructs a SortedLinkedList from a comma-separated string of integers. -
Method Summary
Modifier and TypeMethodDescriptionGetter for the sorted link list.static void
The main method to demonstrate the SortedLinkedList functionality.toString()
Returns a string representation of the sorted linked list.
-
Constructor Details
-
SortedLinkedList
Constructs a SortedLinkedList from a comma-separated string of integers. If the string is null or empty, an empty list is created. If the string cannot be parsed, an error is printed.- Parameters:
integerString
- A string containing comma-separated integers.
-
-
Method Details
-
getSortedLinkedList
Getter for the sorted link list.- Returns:
- A sorted LinkedList of integers or null if the integer string was unable to be parsed.
-
toString
Returns a string representation of the sorted linked list. -
main
The main method to demonstrate the SortedLinkedList functionality. Prompts the user to enter a comma-separated string of integers, creates a SortedLinkedList, and prints it.- Parameters:
args
- Command line arguments (not used).
-