Question: In JAVA please, please follow all instructions exactly 8. (8 points) Given the following class IntNode, complete method static boolean doubled(int i, IntNode 1s) to
In JAVA please, please follow all instructions exactly

8. (8 points) Given the following class IntNode, complete method static boolean doubled(int i, IntNode 1s) to return true if the in teger, i, appears in at least two consecutive nodes in the list and false otherwise. You may assume the list is NOT headed. Examples: Is > 10->20 doubled (10, 1s); >30 > 10 --> 20 --> 51 returns false because 10 is not found in any two consecutive nodes Is >10 > 20 > 20 > 10 -> 51 doubled (20, 1s); returns true because 20 appears consecutively Is 10->20 --> 20 > 20 -> 51 doubled (20, 1s); returns true because 20 appears consecutively (and actually more) public class IntNode { private int value; private IntNode next; public IntNode(int v, IntNode node) { value = v; next = node; } public IntNode() {} public int getValue() { return value; } public void setValue(int v) { value = v; } public IntNode getNext() { return next; } public void setNext (IntNode node) { next = node; } public static boolean doubled(int i, IntNode 1s) { // complete this method } // class IntNode
Step by Step Solution
There are 3 Steps involved in it
Heres the completed doubled method that checks if an integer appears in at least two consecutive nod... View full answer
Get step-by-step solutions from verified subject matter experts
