From 122e6e27cadcd1a12ebc231da0c195621268cea1 Mon Sep 17 00:00:00 2001 From: orange Date: Tue, 27 Dec 2016 17:13:07 +0100 Subject: [PATCH] Test SimpleList --- src/StruttureDati/SimpleList/Test.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/StruttureDati/SimpleList/Test.java diff --git a/src/StruttureDati/SimpleList/Test.java b/src/StruttureDati/SimpleList/Test.java new file mode 100644 index 0000000..7f89d91 --- /dev/null +++ b/src/StruttureDati/SimpleList/Test.java @@ -0,0 +1,25 @@ +import java.util.Scanner; + +public class Test{ + public static void main(String [] args) throws Exception { + Scanner sc = new Scanner(System.in); + SimpleList list = new SimpleList(); + + System.out.println("Stringa: "); + String line = sc.nextLine(); + + while(!line.equals("")) { + list.addHead(line); + System.out.println("Stringa: "); + line = sc.nextLine(); + } + + System.out.println("lunghezza lista: " + list.size()); + + while(!list.isEmpty()){ + line = (String) list.head(); + System.out.println(line); + list.remHead(); + } + } +} \ No newline at end of file