D
D
dc65k2021-07-01 10:31:17
Java
dc65k, 2021-07-01 10:31:17

How to describe the structure of a singly linked list in Java?

Hi everybody. Can you tell me how to describe the following singly linked list structure in Java?

{
  "value": 1,
  "next": {
    "value": 2,
    "next": {
      "value": 3,
      "next": {
        "value": 4,
        "next": null
      }
    }
  }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
BorLaze, 2021-07-01
@dc65k

So describe.

public class Node {
    private int value;
    private Node next;
    // constructors-getters-setters here
}

J
Jacen11, 2021-07-01
@Jacen11

like LinkedList only without prev

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question