Java: Problems using lambda expressions in a generic type listing method

1

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));
    
asked by anonymous 23.06.2018 / 15:57

1 answer

-2

The final version of the code I made with the suggestions for implementation of the circularly double-linked list using lambda and generics (along with the other part of questioning ) I played here in this repository if I can help anyone: link

    
27.06.2018 / 19:50