Class IntNode
- java.lang.Object
-
- IntNode
-
public class IntNode extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNodeAfterThis(int newdata)adds a new IntNode after the node it's called fromvoidaddRangeAfterThis(int start, int end)add a range of ints to a ListintgetData()IntNodegetLink()static intlistLength(IntNode head)gets the number of nodes after the one it's called from.voidprintData()prints out the toString value of the Node.voidremoveNodeAfterThis()removes the IntNode after the one it's called fromvoidremoveXNodesAfterThis(int count)removes an X number of nodes starting from the node it's called fromstatic booleansearch(IntNode head, int _data)searches for a data input and returns whether or not it exists in the ListvoidsetData(int data)voidsetLink(IntNode link)java.lang.StringtoString()Builds a string from all the nodes in the list.
-
-
-
Constructor Detail
-
IntNode
public IntNode()
default constructor
-
IntNode
public IntNode(int _data, IntNode _node)- Parameters:
_data- The new data value to assign_node- The next IntNode in the list
-
-
Method Detail
-
removeXNodesAfterThis
public void removeXNodesAfterThis(int count)
removes an X number of nodes starting from the node it's called from- Parameters:
count- the number of nodes you want to remove
-
addRangeAfterThis
public void addRangeAfterThis(int start, int end)add a range of ints to a List- Parameters:
start- the start of the rangeend- the end of the range
-
getData
public int getData()
-
setData
public void setData(int data)
-
getLink
public IntNode getLink()
-
setLink
public void setLink(IntNode link)
-
addNodeAfterThis
public void addNodeAfterThis(int newdata)
adds a new IntNode after the node it's called from- Parameters:
newdata- the data you want to add (int)
-
removeNodeAfterThis
public void removeNodeAfterThis()
removes the IntNode after the one it's called from
-
listLength
public static int listLength(IntNode head)
gets the number of nodes after the one it's called from.- Parameters:
head- the head node you want to start from- Returns:
- the number of items in the List
-
search
public static boolean search(IntNode head, int _data)
searches for a data input and returns whether or not it exists in the List- Parameters:
head- the head node to start from in the search loop_data- the data you want to search for- Returns:
- true or false depending on what it finds
-
toString
public java.lang.String toString()
Builds a string from all the nodes in the list.- Overrides:
toStringin classjava.lang.Object- Returns:
- a string of the data separated by arrows.
-
printData
public void printData()
prints out the toString value of the Node.
-
-