LinkedLIst and Switch Case Java to add middle string [closed]

61
September 24, 2021, at 10:40 AM
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 17 hours ago.

Improve this question

enter image description herei have word that i want to add it to first or last in linked list. how can i input the middle word of this sentence ex.

5
ADD axa FIRST
ADD cas LAST
PRINT
ADD paw FIRST
PRINT

than the output will be

axa cas
paw axa cas

if it just the first sentence it will be like this

Scanner input = new Scanner(System.in);
        LinkedList data = new LinkedList();
        String word;
        int jml;
        jml = input.nextInt();
    
    for (int i = 0; i < jml; i++) {
        kata = input.next();
        switch (word) {
            case "ADD":
                data.add(input.next());
                break;
            case "PRINT":
                System.out.println(data.get());
                break;
            default:
                throw new AssertionError(); 

`

READ ALSO
SVG `fill` overlaps `stroke`

SVG `fill` overlaps `stroke`

Having a circle it has fill and strokeBut I see that fill color overlaps little bit stroke

82
Get MIN, MAX values from a linking table

Get MIN, MAX values from a linking table

I have 3 tables in a MYSQL DB

75
How to avoid duplicate items in PagingAdapter?

How to avoid duplicate items in PagingAdapter?

I have implemented paging3 for my android projectTo avoid duplicated items, I created a DiffUtil

39