- java.lang.Object
-
- io.github.astrapi69.tree.binary.LinkedNode<T>
-
- Type Parameters:
T
- the generic type of the value
public class LinkedNode<T> extends java.lang.Object
The classLinkedNode
is a representation of a binary tree node and can have only one next element and one previous element and a current value.
-
-
Constructor Summary
Constructors Constructor Description LinkedNode(T value)
Instantiates a newLinkedNode
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LinkedNode<T>
getFirst()
Gets the firstLinkedNode
objectint
getNextCount()
Gets the next count.java.util.List<LinkedNode<T>>
getNextLinkedNodes()
Gets all nextLinkedNode
from the current linked nodeboolean
hasNext()
Checks if this tree node has a next objectboolean
hasPrevious()
Checks for previous objectboolean
isFirst()
Checks if this is the first objectjava.util.List<LinkedNode<T>>
toList()
Transforms this linked node object to an orderedLinkedList
with all nodes
-
-
-
Constructor Detail
-
LinkedNode
public LinkedNode(T value)
Instantiates a newLinkedNode
- Parameters:
value
- the value
-
-
Method Detail
-
getFirst
public LinkedNode<T> getFirst()
Gets the firstLinkedNode
object- Returns:
- the first
LinkedNode
object
-
hasPrevious
public boolean hasPrevious()
Checks for previous object- Returns:
- true, if successful
-
isFirst
public boolean isFirst()
Checks if this is the first object- Returns:
- true, if is first
-
getNextCount
public int getNextCount()
Gets the next count.- Returns:
- the next count
-
getNextLinkedNodes
public java.util.List<LinkedNode<T>> getNextLinkedNodes()
Gets all nextLinkedNode
from the current linked node- Returns:
- all next
LinkedNode
from the current linked node
-
hasNext
public boolean hasNext()
Checks if this tree node has a next object- Returns:
- true, if successful
-
toList
public java.util.List<LinkedNode<T>> toList()
Transforms this linked node object to an orderedLinkedList
with all nodes- Returns:
- the ordered
LinkedList
with all nodes
-
-