3 ms·
Why not a Map? It will have search complexity of 1 If it should take into account ip blocks then just put the ranges in an sorted index and you have logarhytmi
by arein3 4y ago
Why not a Map? It will have search complexity of 1
If it should take into account ip blocks then just put the ranges in an sorted index and you have logarhytmic complexity for search (if speed is important and the blacklist is not huge, you can also expand the blacklisted ranges by individual ip and put them in a Map so that you get complexity of 1 for ip range search)