Search code examples
javalinked-listdoubly-linked-list

Is 'class Node' a java library component?


I have been asked to implement a doubly linked list without using any java library components. Is 'Node' a java library component? So if I create a class:private static class Node{ } is that breaking the rules?


Solution

  • There are several Node classes in Java (for example java.util.LinkedList.Node, java.util.HashMap.Node, org.w3c.dom.Node).

    If you create your own class private static class Node{ } then it will be your own class which has nothing in common with the various node classes from the java libraries except for the simple name (Node).

    Using a name for a class that happens to be similar to a name that the java libraries use for different classes and purposes is not the same as using the java library components themselves.