我正在使用Pcap4j做一个与网络有关的项目,所以我在容器中包含了一个 ArrayList lala = new ArrayList():
[address: [/fe80:0:0:0:5553:d825:1df7:4cba] netmask: [null] broadcastAddr: [null] dstAddr [null], address: [/172.27.186.173] netmask: [/255.255.248.0] broadcastAddr: [/0.0.0.0] dstAddr [null]]
[address: [/fe80:0:0:0:5d9d:acdf:f914:d0c3] netmask: [null] broadcastAddr: [null] dstAddr [null], address: [/172.27.190.111] netmask: [/255.255.248.0] broadcastAddr: [/255.255.255.255] dstAddr [null]]
我想在下面打印输出,但是目前,我只能在^上面打印代码:
address: [/172.27.186.173]
address: [/172.27.190.111]
答案 0 :(得分:1)
You can use:
addressList.stream().map(a -> a.getAddress()).forEach(System.out::println);