Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String toString () // Time complexity: O(n), Space complexity: O(1)
- {
- String str = "{";
- IntNode current = _head;
- while (current != null) // Goes through the set and print each element.
- {
- str += current.getValue() + ",";
- current = current.getNext();
- }
- str += + "}"; // Closes the set with closing bracket.
- return str;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement