Reputation: 217
I'm wondering what will be the most efficient way to make a hash containing some elements (in JAVA).
I want to have in this hash objects of my class Node that are similar to those representing class File, but I don't use most of the functions and fields from it (I use only path, filename and isDirectory), and I implement few fields and methods specific for my objects.
Important thing to add is that constructors of Nodes build up basing on File objects. So what will be the most efficient - to make my Node extend File or to leave it as it is - unrelated but the moment of construction?
Upvotes: 2
Views: 103
Reputation: 19221
Is your Node
a File
? It is rare to implement a base class when you aren't a specific type of the base.
It sounds like you don't need a hierarchy in this case, as it doesn't buy you anything when you are only storing metadata.
Upvotes: 4