In Java, i have an arrayList of ip address. how do i find the min and max ?
I have used the Collection.min() but it doesnt work given a case like :
192.168.0.1 <--min
192.168.0.250
192.168.0.9 <--max
how do i return
192.168.0.1 <--min
192.168.0.250 <--max
instead?
ArrayList is retrieve from the database. I would need to do this operation per tick (each tick is at 5 sec interval). The number of IP address would hit a max of probably 300.
Referring to Java – IP Address to Integer and back
Retrieving from the database the Ip address String, I converted all to a ArrayList and then apply the Collection.min()
Then I convert back the long to int and then back to String. To obtain a sorted String of ip addresses.
Thanks