/**
  * Copyright (c): Uwe Schmidt, FH Wedel
  *
  * You may study, modify and distribute this source code
  * FOR NON-COMMERCIAL PURPOSES ONLY.
  * This copyright message has to remain unchanged.
  *
  * Note that this document is provided 'as is',
  * WITHOUT WARRANTY of any kind either expressed or implied.
  */

package tests.destructive.list;

import ds.interfaces.List;
import ds.util.E;

import static ds.destructive.list.LinkedList.empty;
import static ds.destructive.list.LinkedList.stats;
import static ds.util.E.mkE;

import static java.lang.System.out;

public class LinkedList1 {
    public static void main(String [] argv) {
	List l = empty();

	l = l.cons(mkE(4)).cons(mkE(3)).cons(mkE(2)).cons(mkE(1));
	l = l.concat(l.copy()); // requires cloning before concat

	out.println("l                 : " + l);
	out.println("l.isEmpty()       : " + l.isEmpty());
	out.println("l.length()        : " + l.length());
	out.println("l.head()          : " + l.head());
	out.println("l.at(3)           : " + l.at(3));
	out.println("l.member(3)       : " + l.member(mkE(3)));
	out.println("l.member(9)       : " + l.member(mkE(9)));

	List l2;
	out.println("l2 = l.tail()     : " + (l2 = l.tail()));
	out.println("l2 = l2.reverse() : " + (l2 = l2.reverse()));
	out.println("l2.length()       : " + l2.length());
	out.println("l                 : " + l);

	out.println("\n" + stats());
    }
}