I’m currently working on a project,
I need something that I can provide a name, then it can return what kind of item it is.
Say I have word starcraft,
then the API or some database can return something like game
or nba -> sports
or nike -> sports/shoe
or sadkljasd -> unknown
I saw something did this like months ago, but I can not recall.
I need something that has this kind functionality and data, and it does not have to be accurate
Anyone has any idea?
Thanks a lot
HashMap provides the kind of API you are looking for..
You can have a mapping from your item to their type.. In a Map, you store your mapping in the form of
Key-ValuePair… If all your items are unique, it will be the best bet for you..Here I will give a brief example of how a Map works.. Rest you can get from the link I have given..
And if you have
multipletypes for some items, you can have aMappingfromitemsto thelistof their types: –