The problem would be that I can not multiply the variables that return from the listing using lambda (e * e), so it asks to create a listing method using object, but to using generics. Thanks for any input.
public Element<T> listing() {
Element<T> e = head;
System.out.println("");
System.out.println("Start listing... ");
while (e != null) {
System.out.println("Value: " + e.getValue());
e = e.getNext();
}
System.out.println("End listing");
System.out.println("");
return e;
}
Call
Deque<String> deque = new Deque<String>();
deque.addFirst("zero");
deque.addFirst("first");
deque.addFirst("secound");
deque.addFirst("third");
deque.addLast("fifth");
deque.listing((e)-> System.out.println(e*e));