Select the first device from paired devices

How to select the first device in the list pairedDeviceswithout using a loop for?

A number from 0, as in a regular array, or from 1?

Set<BluetoothDevice> pairedDevices = BA.getBondedDevices();
+4
source share
1 answer

Setis unordered Collection, items cannot be accessed by index.

The closest you can do is something like this:

BluetoothDevice firstDevice = pairedDevices.iterator().next();
+2
source

Source: https://habr.com/ru/post/1654647/


All Articles