Methods Summary |
---|
static void | checkAdapterStateOn(android.bluetooth.BluetoothAdapter adapter)Ensure Bluetooth is turned on.
if (adapter == null || adapter.getState() != BluetoothAdapter.STATE_ON) {
throw new IllegalStateException("BT Adapter is not turned ON");
}
|
static boolean | equals(android.util.SparseArray array, android.util.SparseArray otherArray)Check whether two {@link SparseArray} equal.
if (array == otherArray) {
return true;
}
if (array == null || otherArray == null) {
return false;
}
if (array.size() != otherArray.size()) {
return false;
}
// Keys are guaranteed in ascending order when indices are in ascending order.
for (int i = 0; i < array.size(); ++i) {
if (array.keyAt(i) != otherArray.keyAt(i) ||
!Arrays.equals(array.valueAt(i), otherArray.valueAt(i))) {
return false;
}
}
return true;
|
static boolean | equals(java.util.Map map, java.util.Map otherMap)Check whether two {@link Map} equal.
if (map == otherMap) {
return true;
}
if (map == null || otherMap == null) {
return false;
}
if (map.size() != otherMap.size()) {
return false;
}
Set<T> keys = map.keySet();
if (!keys.equals(otherMap.keySet())) {
return false;
}
for (T key : keys) {
if (!Objects.deepEquals(map.get(key), otherMap.get(key))) {
return false;
}
}
return true;
|
static java.lang.String | toString(android.util.SparseArray array)Returns a string composed from a {@link SparseArray}.
if (array == null) {
return "null";
}
if (array.size() == 0) {
return "{}";
}
StringBuilder buffer = new StringBuilder();
buffer.append('{");
for (int i = 0; i < array.size(); ++i) {
buffer.append(array.keyAt(i)).append("=").append(Arrays.toString(array.valueAt(i)));
}
buffer.append('}");
return buffer.toString();
|
static java.lang.String | toString(java.util.Map map)Returns a string composed from a {@link Map}.
if (map == null) {
return "null";
}
if (map.isEmpty()) {
return "{}";
}
StringBuilder buffer = new StringBuilder();
buffer.append('{");
Iterator<Map.Entry<T, byte[]>> it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<T, byte[]> entry = it.next();
Object key = entry.getKey();
buffer.append(key).append("=").append(Arrays.toString(map.get(key)));
if (it.hasNext()) {
buffer.append(", ");
}
}
buffer.append('}");
return buffer.toString();
|