-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1250 from IranNeto/master
add LinkedList
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
Program's_Contributed_By_Contributors/Java_Programs/Data_structure/LinkedList.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
public class LinkedList { | ||
|
||
public Node head = new Node(); | ||
|
||
public Node getHead() { | ||
return head; | ||
} | ||
|
||
public void setHead(Node head) { | ||
this.head = head; | ||
} | ||
|
||
class Node { | ||
private int value; | ||
private Node next; | ||
|
||
public int getValue() { | ||
return value; | ||
} | ||
|
||
public void setValue(int value) { | ||
this.value = value; | ||
} | ||
|
||
public Node getNext() { | ||
return next; | ||
} | ||
|
||
public void setNext(Node next) { | ||
this.next = next; | ||
} | ||
|
||
public Node(int value, Node next){ | ||
this.value = value; | ||
this.next = next; | ||
} | ||
|
||
public Node(int value){ | ||
this.value = value; | ||
} | ||
|
||
public Node(){} | ||
} | ||
} |