本文整理汇总了Java中android.util.SparseLongArray类的典型用法代码示例。如果您正苦于以下问题:Java SparseLongArray类的具体用法?Java SparseLongArray怎么用?Java SparseLongArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SparseLongArray类属于android.util包,在下文中一共展示了SparseLongArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: values
import android.util.SparseLongArray; //导入依赖的package包/类
private static <E> Object values(SparseArray<E> a, SparseBooleanArray b, SparseIntArray c,
SparseLongArray d, LongSparseArray<E> e) {
int size = size(a, b, c, d, e);
ArrayList<E> vals = a != null || e != null ? new ArrayList<>(size) : null;
boolean[] bools = b != null ? new boolean[size] : null;
int[] ints = c != null ? new int[size] : null;
long[] longs = d != null ? new long[size] : null;
for (int i = 0; i < size; i++) {
if (vals != null) {
vals.add(a != null ? a.valueAt(i) : e.valueAt(i));
} else if (bools != null) {
bools[i] = b.valueAt(i);
} else if (ints != null) {
ints[i] = c.valueAt(i);
} else if (longs != null) {
longs[i] = d.valueAt(i);
}
}
return vals != null ? vals : bools != null ? bools : ints != null ? ints : longs;
}
示例2: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
public static boolean isEmpty(Object obj) {
if (obj == null) {
return true;
}
if (obj instanceof String && obj.toString().length() == 0) {
return true;
}
if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
return true;
}
if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
return true;
}
if (obj instanceof Map && ((Map) obj).isEmpty()) {
return true;
}
if (obj instanceof SparseArray && ((SparseArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseBooleanArray && ((SparseBooleanArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseIntArray && ((SparseIntArray) obj).size() == 0) {
return true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (obj instanceof SparseLongArray && ((SparseLongArray) obj).size() == 0) {
return true;
}
}
return false;
}
示例3: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
/**
* 判断对象是否为空
*
* @param obj 对象
* @return {@code true}: 为空<br>{@code false}: 不为空
*/
public static boolean isEmpty(Object obj) {
if (obj == null) {
return true;
}
if (obj instanceof String && obj.toString().length() == 0) {
return true;
}
if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
return true;
}
if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
return true;
}
if (obj instanceof Map && ((Map) obj).isEmpty()) {
return true;
}
if (obj instanceof SparseArray && ((SparseArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseBooleanArray && ((SparseBooleanArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseIntArray && ((SparseIntArray) obj).size() == 0) {
return true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (obj instanceof SparseLongArray && ((SparseLongArray) obj).size() == 0) {
return true;
}
}
return false;
}
示例4: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@Test
public void isEmpty() throws Exception {
String string = "";
String string1 = " ";
int[][] arr = new int[][]{};
int[] arr1 = null;
LinkedList<Integer> list = new LinkedList<>();
HashMap<String,Integer> map = new HashMap<>();
SparseArray<String> sa = new SparseArray<>();
SparseBooleanArray sba = new SparseBooleanArray();
SparseIntArray sia = new SparseIntArray();
SparseLongArray sla = new SparseLongArray();
assertThat(EmptyUtils.isEmpty(string)).isTrue();
assertThat(EmptyUtils.isEmpty(string1)).isFalse();
assertThat(EmptyUtils.isEmpty(arr)).isTrue();
assertThat(EmptyUtils.isEmpty(arr1)).isTrue();
assertThat(EmptyUtils.isEmpty(list)).isTrue();
assertThat(EmptyUtils.isEmpty(map)).isTrue();
assertThat(EmptyUtils.isEmpty(sa)).isTrue();
assertThat(EmptyUtils.isEmpty(sba)).isTrue();
assertThat(EmptyUtils.isEmpty(sia)).isTrue();
assertThat(EmptyUtils.isEmpty(sla)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(string)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(string1)).isFalse();
assertThat(!EmptyUtils.isNotEmpty(arr)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(arr1)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(list)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(map)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(sa)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(sba)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(sia)).isTrue();
assertThat(!EmptyUtils.isNotEmpty(sla)).isTrue();
}
示例5: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
/**
* 判断对象是否为null或长度数量为0
*
* @param obj 对象
* @return {@code true}: 为空<br>{@code false}: 不为空
*/
public static boolean isEmpty(Object obj) {
if (obj == null) {
return true;
}
if (obj instanceof String && obj.toString().length() == 0) {
return true;
}
if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
return true;
}
if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
return true;
}
if (obj instanceof Map && ((Map) obj).isEmpty()) {
return true;
}
if (obj instanceof SparseArray && ((SparseArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseBooleanArray && ((SparseBooleanArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseIntArray && ((SparseIntArray) obj).size() == 0) {
return true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (obj instanceof SparseLongArray && ((SparseLongArray) obj).size() == 0) {
return true;
}
}
return false;
}
示例6: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
/**
* 判断对象是否为空
*
* @param obj 对象
* @return {@code true}: 为空<br>{@code false}: 不为空
*/
public static boolean isEmpty(Object obj) {
if (obj == null) {
return true;
}
if (obj instanceof String && obj.toString().length() == 0) {
return true;
}
if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
return true;
}
if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
return true;
}
if (obj instanceof Map && ((Map) obj).isEmpty()) {
return true;
}
if (obj instanceof SparseArray && ((SparseArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseBooleanArray &&
((SparseBooleanArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseIntArray &&
((SparseIntArray) obj).size() == 0) {
return true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (obj instanceof SparseLongArray &&
((SparseLongArray) obj).size() == 0) {
return true;
}
}
return false;
}
示例7: type
import android.util.SparseLongArray; //导入依赖的package包/类
public static SubjectFactory<SparseLongArraySubject, SparseLongArray> type() {
return new SubjectFactory<SparseLongArraySubject, SparseLongArray>() {
@Override
public SparseLongArraySubject getSubject(FailureStrategy fs, SparseLongArray that) {
return new SparseLongArraySubject(fs, that);
}
};
}
示例8: DeviceClient
import android.util.SparseLongArray; //导入依赖的package包/类
private DeviceClient(Context context) {
this.context = context;
googleApiClient = new GoogleApiClient.Builder(context).addApi(Wearable.API).build();
executorService = Executors.newCachedThreadPool();
lastSensorData = new SparseLongArray();
}
示例9: keys
import android.util.SparseLongArray; //导入依赖的package包/类
private static Object keys(SparseArray<?> a, SparseBooleanArray b, SparseIntArray c,
SparseLongArray d, LongSparseArray<?> e) {
int size = size(a, b, c, d, e);
int[] ints = a != null || b != null || c != null || d != null ? new int[size] : null;
long[] longs = e != null ? new long[size] : null;
for (int i = 0; i < size; i++) {
if (ints != null) {
ints[i] = a != null ? a.keyAt(i)
: b != null ? b.keyAt(i) : c != null ? c.keyAt(i) : d.keyAt(i);
} else if (longs != null) {
longs[i] = e.keyAt(i);
}
}
return ints != null ? ints : longs;
}
示例10: TranslatedSparseLongArrayIterableImpl
import android.util.SparseLongArray; //导入依赖的package包/类
public TranslatedSparseLongArrayIterableImpl(final SparseLongArrayIterableImpl wrapped,
final FullIntTranslator keyTranslator, final FullLongTranslator valueTranslator) {
super((SparseLongArray) null);
mIterable = wrapped;
mKeyTranslator = keyTranslator;
mValueTranslator = valueTranslator;
}
示例11: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
/**
* 判断对象是否为空
*
* @param obj 对象
* @return {@code true}: 为空<br>{@code false}: 不为空
*/
public static boolean isEmpty(final Object obj) {
if (obj == null) {
return true;
}
if (obj instanceof String && obj.toString().length() == 0) {
return true;
}
if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
return true;
}
if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
return true;
}
if (obj instanceof Map && ((Map) obj).isEmpty()) {
return true;
}
if (obj instanceof SimpleArrayMap && ((SimpleArrayMap) obj).isEmpty()) {
return true;
}
if (obj instanceof SparseArray && ((SparseArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseBooleanArray && ((SparseBooleanArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseIntArray && ((SparseIntArray) obj).size() == 0) {
return true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (obj instanceof SparseLongArray && ((SparseLongArray) obj).size() == 0) {
return true;
}
}
if (obj instanceof LongSparseArray && ((LongSparseArray) obj).size() == 0) {
return true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (obj instanceof android.util.LongSparseArray && ((android.util.LongSparseArray) obj).size() == 0) {
return true;
}
}
return false;
}
示例12: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
@Test
public void isEmpty() throws Exception {
String string = "";
String string1 = " ";
int[][] arr = new int[][]{};
int[] arr1 = null;
LinkedList<Integer> list = new LinkedList<>();
HashMap<String, Integer> map = new HashMap<>();
SimpleArrayMap<String, Integer> sam = new SimpleArrayMap<>();
SparseArray<String> sa = new SparseArray<>();
SparseBooleanArray sba = new SparseBooleanArray();
SparseIntArray sia = new SparseIntArray();
SparseLongArray sla = new SparseLongArray();
LongSparseArray<String> lsa = new LongSparseArray<>();
android.util.LongSparseArray<String> lsaV4 = new android.util.LongSparseArray<>();
assertTrue(EmptyUtils.isEmpty(string));
assertFalse(EmptyUtils.isEmpty(string1));
assertTrue(EmptyUtils.isEmpty(arr));
assertTrue(EmptyUtils.isEmpty(arr1));
assertTrue(EmptyUtils.isEmpty(list));
assertTrue(EmptyUtils.isEmpty(map));
assertTrue(EmptyUtils.isEmpty(sam));
assertTrue(EmptyUtils.isEmpty(sa));
assertTrue(EmptyUtils.isEmpty(sba));
assertTrue(EmptyUtils.isEmpty(sia));
assertTrue(EmptyUtils.isEmpty(sla));
assertTrue(EmptyUtils.isEmpty(lsa));
assertTrue(EmptyUtils.isEmpty(lsaV4));
assertTrue(!EmptyUtils.isNotEmpty(string));
assertFalse(!EmptyUtils.isNotEmpty(string1));
assertTrue(!EmptyUtils.isNotEmpty(arr));
assertTrue(!EmptyUtils.isNotEmpty(arr1));
assertTrue(!EmptyUtils.isNotEmpty(list));
assertTrue(!EmptyUtils.isNotEmpty(map));
assertTrue(!EmptyUtils.isNotEmpty(sam));
assertTrue(!EmptyUtils.isNotEmpty(sa));
assertTrue(!EmptyUtils.isNotEmpty(sba));
assertTrue(!EmptyUtils.isNotEmpty(sia));
assertTrue(!EmptyUtils.isNotEmpty(sla));
assertTrue(!EmptyUtils.isNotEmpty(lsa));
assertTrue(!EmptyUtils.isNotEmpty(lsaV4));
}
示例13: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
/**
* 判断对象是否为空
*
* @param obj 对象
* @return {@code true}: 为空<br>{@code false}: 不为空
*/
public static boolean isEmpty(final Object obj) {
if (obj == null) {
return true;
}
if (obj instanceof CharSequence && obj.toString().length() == 0) {
return true;
}
if (obj.getClass().isArray() && Array.getLength(obj) == 0) {
return true;
}
if (obj instanceof Collection && ((Collection) obj).isEmpty()) {
return true;
}
if (obj instanceof Map && ((Map) obj).isEmpty()) {
return true;
}
if (obj instanceof SimpleArrayMap && ((SimpleArrayMap) obj).isEmpty()) {
return true;
}
if (obj instanceof SparseArray && ((SparseArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseBooleanArray && ((SparseBooleanArray) obj).size() == 0) {
return true;
}
if (obj instanceof SparseIntArray && ((SparseIntArray) obj).size() == 0) {
return true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
if (obj instanceof SparseLongArray && ((SparseLongArray) obj).size() == 0) {
return true;
}
}
if (obj instanceof LongSparseArray && ((LongSparseArray) obj).size() == 0) {
return true;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (obj instanceof android.util.LongSparseArray
&& ((android.util.LongSparseArray) obj).size() == 0) {
return true;
}
}
return false;
}
示例14: isEmpty
import android.util.SparseLongArray; //导入依赖的package包/类
@Test
public void isEmpty() throws Exception {
StringBuilder sb = new StringBuilder("");
StringBuilder sb1 = new StringBuilder(" ");
String string = "";
String string1 = " ";
int[][] arr = new int[][]{};
LinkedList<Integer> list = new LinkedList<>();
HashMap<String, Integer> map = new HashMap<>();
SimpleArrayMap<String, Integer> sam = new SimpleArrayMap<>();
SparseArray<String> sa = new SparseArray<>();
SparseBooleanArray sba = new SparseBooleanArray();
SparseIntArray sia = new SparseIntArray();
SparseLongArray sla = new SparseLongArray();
LongSparseArray<String> lsa = new LongSparseArray<>();
android.util.LongSparseArray<String> lsaV4 = new android.util.LongSparseArray<>();
assertTrue(ObjectUtils.isEmpty(sb));
assertFalse(ObjectUtils.isEmpty(sb1));
assertTrue(ObjectUtils.isEmpty(string));
assertFalse(ObjectUtils.isEmpty(string1));
assertTrue(ObjectUtils.isEmpty(arr));
assertTrue(ObjectUtils.isEmpty(list));
assertTrue(ObjectUtils.isEmpty(map));
assertTrue(ObjectUtils.isEmpty(sam));
assertTrue(ObjectUtils.isEmpty(sa));
assertTrue(ObjectUtils.isEmpty(sba));
assertTrue(ObjectUtils.isEmpty(sia));
assertTrue(ObjectUtils.isEmpty(sla));
assertTrue(ObjectUtils.isEmpty(lsa));
assertTrue(ObjectUtils.isEmpty(lsaV4));
assertTrue(!ObjectUtils.isNotEmpty(sb));
assertFalse(!ObjectUtils.isNotEmpty(sb1));
assertTrue(!ObjectUtils.isNotEmpty(string));
assertFalse(!ObjectUtils.isNotEmpty(string1));
assertTrue(!ObjectUtils.isNotEmpty(arr));
assertTrue(!ObjectUtils.isNotEmpty(list));
assertTrue(!ObjectUtils.isNotEmpty(map));
assertTrue(!ObjectUtils.isNotEmpty(sam));
assertTrue(!ObjectUtils.isNotEmpty(sa));
assertTrue(!ObjectUtils.isNotEmpty(sba));
assertTrue(!ObjectUtils.isNotEmpty(sia));
assertTrue(!ObjectUtils.isNotEmpty(sla));
assertTrue(!ObjectUtils.isNotEmpty(lsa));
assertTrue(!ObjectUtils.isNotEmpty(lsaV4));
}
示例15: SparseLongArraySubject
import android.util.SparseLongArray; //导入依赖的package包/类
protected SparseLongArraySubject(FailureStrategy failureStrategy, SparseLongArray subject) {
super(failureStrategy, subject);
}