Skip to content

Commit ef231ad

Browse files
aryasaatviksjwarner-bp
authored andcommitted
linked-list: make classes and methods package private (exercism#1066)
Fixes exercism#1055 * make classes and methods package private exercism#1055 * changed nested class to public * made Element<T> private and its constructor package-private
1 parent f760169 commit ef231ad

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎exercises/linked-list/.meta/src/reference/java/DoublyLinkedList.java‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
public final class DoublyLinkedList<T> {
1+
final class DoublyLinkedList<T> {
22
private Element<T> head;
33

4-
public void push(T value) {
4+
void push(T value) {
55
if (head == null) {
66
head = new Element<>(value, null, null);
77
head.next = head;
@@ -15,17 +15,17 @@ public void push(T value) {
1515
head.prev = tail;
1616
}
1717

18-
public T pop() {
18+
T pop() {
1919
head = head.prev;
2020
return shift();
2121
}
2222

23-
public void unshift(T value) {
23+
void unshift(T value) {
2424
push(value);
2525
head = head.prev;
2626
}
2727

28-
public T shift() {
28+
T shift() {
2929
T value = head.value;
3030

3131
Element<T> newHead = head.next;
@@ -48,7 +48,7 @@ private static final class Element<T> {
4848
private Element<T> prev;
4949
private Element<T> next;
5050

51-
public Element(T value, Element<T> prev, Element<T> next) {
51+
Element(T value, Element<T> prev, Element<T> next) {
5252
this.value = value;
5353
this.prev = prev;
5454
this.next = next;

0 commit comments

Comments
 (0)