Skip to content

Instantly share code, notes, and snippets.

@Zoomelectrico
Created June 21, 2018 23:49
Show Gist options
  • Save Zoomelectrico/6ba4526733d05cd67eb63a6be6206c9c to your computer and use it in GitHub Desktop.
Save Zoomelectrico/6ba4526733d05cd67eb63a6be6206c9c to your computer and use it in GitHub Desktop.
Clase Nodo TypeScript
/**
* @class Node
*/
export default class Node {
private data: any;
private next: Node;
/**
* @constructor constructor de la clase
* @param data {any} el dato que quieres que el nodo contenga
*/
constructor(data: any) {
this.data = data;
this.next = null;
}
/**
* @function getNext
* @return null si el siguiente nodo es null o el siguiente nodo de la lista
*/
public getNext(): Node {
return this.next;
}
public getData(): any {
return this.data;
}
public setNext(next: Node): void {
this.next = next;
}
public setData(data: any): void {
this.data = data;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment