Here you can find the source of sortInterfaces(List
private static void sortInterfaces(List<NetworkInterface> interfaces)
//package com.java2s; //License from project: Apache License import java.net.NetworkInterface; import java.util.Collections; import java.util.Comparator; import java.util.List; public class Main { private static void sortInterfaces(List<NetworkInterface> interfaces) { Collections.sort(interfaces, new Comparator<NetworkInterface>() { @Override//www . j ava 2 s . c om public int compare(NetworkInterface o1, NetworkInterface o2) { return Integer.compare(o1.getIndex(), o2.getIndex()); } }); } }