java - remove an element from a linked list -


I need help extracting an element from the list of links, any help by the user prompt is appreciated, this is what I have done so far, but it does not seem to work.

  Public Zero Extract List (Linked List) {System.out.println (someList); Scanner input = new scanner (System.in); System.out.println ("Enter a string to delete:"); String s = input.nextLine (); For (int i = 0; i & lt; someList.size (); i ++) {if (s.equals (someList)) {someList.remove (s); Println (someList.get (i)); }}  

You do not need to use the loop here. You can call the straight away method.

Try below

  Public Zero Remove List (Linked List) {System.out.println (someList); Scanner input = new scanner (System.in); System.out.println ("Enter a string to delete:"); String s = input.nextLine (); SomeList.remove (s); Println (someList); }  

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -