jgonian / commons-ip-math

https://github.com/jgonian/commons-ip-math
MIT License
74 stars 19 forks source link

Please add Ipv4Set and Ipv6Set #17

Closed MugeSo closed 7 years ago

MugeSo commented 7 years ago

It must be useful then SortedResourceSet<Ipv4, Ipv4Range>.

jgonian commented 7 years ago

@MugeSo can you add more details to your request?

If you simply want a set of IPv4 or IPv6 addresses you can use java's collections, e.g.

import java.util.*;
import com.github.jgonian.ipmath.*;

Set<Ipv4> ipv4Set = new HashSet<Ipv4>();
ipv4Set.add(Ipv4.of("192.168.0.1"));
ipv4Set.add(Ipv4.of("192.168.0.1"));
ipv4Set.add(Ipv4.of("192.168.0.2"));
System.out.println(ipv4Set);              // will print: [192.168.0.1, 192.168.0.2]