X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=Listes%2FListe.java;h=167a79d34507a8ff2079ea33f8ac00b9d39afa5a;hb=fe44e32c85d49902ab95482dbc3ee4b815386a2b;hp=6dd1c5fb58abc7194f905d2bda87f75b385b9139;hpb=684b6099df9f03c36286252a07272358a98c9091;p=TP_POO.git diff --git a/Listes/Liste.java b/Listes/Liste.java index 6dd1c5f..167a79d 100644 --- a/Listes/Liste.java +++ b/Listes/Liste.java @@ -1,38 +1,39 @@ -class IntNode { - private int data; - private IntNode next; +public class Liste { - IntNode(int value) { - setData(value); - setNext(null); - } + private class IntNode { + private int data; + private IntNode next; - IntNode(int value, IntNode nextNode) { - setData(value); - setNext(nextNode); - } + IntNode(int value) { + setData(value); + setNext(null); + } - public int getData() { - return data; - } + IntNode(int value, IntNode nextNode) { + setData(value); + setNext(nextNode); + } - public void setData(int value) { - data = value; - } + private int getData() { + return data; + } - public IntNode getNext() { - return next; - } + private void setData(int value) { + data = value; + } - public void setNext(IntNode nextNode) { - next = nextNode; - } + private IntNode getNext() { + return next; + } -} + private void setNext(IntNode nextNode) { + next = nextNode; + } + + } -class Liste { private IntNode headNode; private int list_counter; @@ -43,7 +44,7 @@ class Liste { private boolean isEmpty() { - return headNode == null; + return getHeadNode() == null; } private int getSize() { @@ -115,6 +116,7 @@ class Liste { } public void afficher() { + System.out.println("----"); if (isEmpty()) { System.out.println("Liste vide"); } else if (headNode.getNext() == null) {