SetNetworkListAdapter extends AbstractListAdapter<Network> { @Override public void add(Network network) { switch (network.getType()) { case WIFI: addWiFi( network ); break; case CDMA: case GSM: case WCDMA: case LTE: addCell(network); break; case BT: addBluetooth(network); break; case BLE: addBluetoothLe(network); break; } } SetNetworkListAdapter(final Context context, final int rowLayout); void clearWifiAndCell(); void clearWifi(); void clearCell(); void clearBluetooth(); void clearBluetoothLe(); void morphBluetoothToLe(Network n); void clear(); @Override void add(Network network); void addWiFi(Network n); void addCell(Network n); void addBluetooth(Network n); void addBluetoothLe(Network n); void enqueueBluetooth(Network n); void enqueueBluetoothLe(Network n); void batchUpdateBt(final boolean showCurrent, final boolean updateLe, final boolean updateClassic); @Override boolean isEmpty(); @Override int getCount(); @Override Network getItem(int pPosition); @Override long getItemId(int pPosition); @Override boolean hasStableIds(); void sort(Comparator comparator); @Override View getView(final int position, final View convertView, final ViewGroup parent);  }
@Test public void testAdd() { SetBackedNetworkList netlist = new SetBackedNetworkList(); System.out.print("Inserting WiFi Large Set into SetBackedNetworkList..."); long start = System.currentTimeMillis(); netlist.addAll(wifiLarge); long end = System.currentTimeMillis(); System.out.println(" Inserted in ("+(end-start)+"ms)"); long wifiSize = netlist.size(); if (netlist.add(wifiSmall.get(66))) { Assert.assertEquals(wifiSize+1, netlist.size()); } }