Quick Index
Code Explanation


Greetings, my name is DataNode.

I'm the starting point for nodes in data structures.

I'm as simple as can be. All I do is hold onto data (an object).

You might think I'm lazy, but you'll learn later, I'm a valuable partner.

My data's type can vary -- Integer, String, Car, Employee, etc.

Read more about me below.

I have one ivar of type T.
T is just a placeholder param name.
When I am used, I will replace "T" with a "real" type provided by my object user.
public class DataNode<T> {
	private T data;

	//etc (more code follows)

}
This constructor assigns the passed
values to my two ivars. The param types
match the ivar types (typical).
	public DataNode(T aData)  {
		this.data = aData;
	}
Standard getter method
that returns the ivar "key"
(generic type K)
	public T getData()  {
		return this.data;
	}

Complete Source Code


Here is my code.

Have Fun.

Yours Truly,
DataNode

package datanode.model;


public class DataNode<T> {

	private T data;

	//--------------------------
	//Constructors Here

	public DataNode(T aData) {
		this.data = aData;
	}

	//--------------------------
	//Getters

	public T getData() {
		return this.data;
	}

}